1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
|
<HTML>
<HEAD>
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.6.2 -->
<div class="contents">
<h1>RtMidiIn Class Reference</h1><!-- doxytag: class="RtMidiIn" --><!-- doxytag: inherits="RtMidi" -->
<p>A realtime MIDI input class.
<a href="#_details">More...</a></p>
<p><code>#include <<a class="el" href="RtMidi_8h_source.html">RtMidi.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for RtMidiIn:</div>
<div class="dynsection">
<div class="center">
<img src="classRtMidiIn.png" usemap="#RtMidiIn_map" alt=""/>
<map id="RtMidiIn_map" name="RtMidiIn_map">
<area href="classRtMidi.html" alt="RtMidi" shape="rect" coords="0,0,57,24"/>
</map>
</div>
</div>
<p><a href="classRtMidiIn-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a297d2eb3c3420b437970a6fc59d89cbf"></a><!-- doxytag: member="RtMidiIn::RtMidiCallback" ref="a297d2eb3c3420b437970a6fc59d89cbf" args=")(double timeStamp, std::vector< unsigned char > *message, void *userData)" -->
typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a297d2eb3c3420b437970a6fc59d89cbf">RtMidiCallback</a> )(double timeStamp, std::vector< unsigned char > *message, void *userData)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">User callback function type definition. <br/></td></tr>
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#aeeaeed8dae387dffc70e73e6e88b4d1a">RtMidiIn</a> (<a class="el" href="classRtMidi.html#aac66af04a85fe5c5f07c360574a19406">RtMidi::Api</a> api=UNSPECIFIED, const std::string clientName=std::string("RtMidi Input Client"), unsigned int queueSizeLimit=100)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor that allows an optional api, client name and queue size. <a href="#aeeaeed8dae387dffc70e73e6e88b4d1a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae79f4da8a1b2e7efecdd1047670b27dc"></a><!-- doxytag: member="RtMidiIn::~RtMidiIn" ref="ae79f4da8a1b2e7efecdd1047670b27dc" args="(void)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#ae79f4da8a1b2e7efecdd1047670b27dc">~RtMidiIn</a> (void) throw ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">If a MIDI connection is still open, it will be closed by the destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6475a11eeb0c8bf22157c3887b100164"></a><!-- doxytag: member="RtMidiIn::getCurrentApi" ref="a6475a11eeb0c8bf22157c3887b100164" args="(void)" -->
<a class="el" href="classRtMidi.html#aac66af04a85fe5c5f07c360574a19406">RtMidi::Api</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a6475a11eeb0c8bf22157c3887b100164">getCurrentApi</a> (void) throw ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the MIDI API specifier for the current instance of <a class="el" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a>. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a39df8f81a22f729a9904707dde487d2c">openPort</a> (unsigned int portNumber=0, const std::string portName=std::string("RtMidi Input"))</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Open a MIDI input connection. <a href="#a39df8f81a22f729a9904707dde487d2c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a245261b3f12ce727faed18fcfeef18c2">openVirtualPort</a> (const std::string portName=std::string("RtMidi Input"))</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a virtual input port, with optional name, to allow software connections (OS X and ALSA only). <a href="#a245261b3f12ce727faed18fcfeef18c2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a7590563461c7467608a4b3806406b32d">setCallback</a> (<a class="el" href="classRtMidiIn.html#a297d2eb3c3420b437970a6fc59d89cbf">RtMidiCallback</a> callback, void *userData=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set a callback function to be invoked for incoming MIDI messages. <a href="#a7590563461c7467608a4b3806406b32d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#ade23832a66c1ed56965c26325602543e">cancelCallback</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Cancel use of the current callback function (if one exists). <a href="#ade23832a66c1ed56965c26325602543e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a55bacf0d228fd8e3be6a79d12fd1dc39"></a><!-- doxytag: member="RtMidiIn::closePort" ref="a55bacf0d228fd8e3be6a79d12fd1dc39" args="(void)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a55bacf0d228fd8e3be6a79d12fd1dc39">closePort</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Close an open MIDI connection (if one exists). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a62b1b38aa8e5f11cd66f03d59228f4e4"></a><!-- doxytag: member="RtMidiIn::getPortCount" ref="a62b1b38aa8e5f11cd66f03d59228f4e4" args="()" -->
unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a62b1b38aa8e5f11cd66f03d59228f4e4">getPortCount</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the number of available MIDI input ports. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#af2961fff09fa01a3d5bc0f0c5a042aaf">getPortName</a> (unsigned int portNumber=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return a string identifier for the specified MIDI input port number. <a href="#af2961fff09fa01a3d5bc0f0c5a042aaf"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#af9507125aaa42276ccc01df576fc3533">ignoreTypes</a> (bool midiSysex=true, bool midiTime=true, bool midiSense=true)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Specify whether certain MIDI message types should be queued or ignored during input. <a href="#af9507125aaa42276ccc01df576fc3533"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtMidiIn.html#a1ba10ecd276b30a8579c7d60a9c890eb">getMessage</a> (std::vector< unsigned char > *message)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Fill the user-provided vector with the data bytes for the next available MIDI message in the input queue and return the event delta-time in seconds. <a href="#a1ba10ecd276b30a8579c7d60a9c890eb"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A realtime MIDI input class. </p>
<p>This class provides a common, platform-independent API for realtime MIDI input. It allows access to a single MIDI input port. Incoming MIDI messages are either saved to a queue for retrieval using the <a class="el" href="classRtMidiIn.html#a1ba10ecd276b30a8579c7d60a9c890eb" title="Fill the user-provided vector with the data bytes for the next available MIDI message...">getMessage()</a> function or immediately passed to a user-specified callback function. Create multiple instances of this class to connect to more than one MIDI device at the same time. With the OS-X and Linux ALSA MIDI APIs, it is also possible to open a virtual input port to which other MIDI software clients can connect.</p>
<p>by Gary P. Scavone, 2003-2012. </p>
<hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="aeeaeed8dae387dffc70e73e6e88b4d1a"></a><!-- doxytag: member="RtMidiIn::RtMidiIn" ref="aeeaeed8dae387dffc70e73e6e88b4d1a" args="(RtMidi::Api api=UNSPECIFIED, const std::string clientName=std::string("RtMidi Input Client"), unsigned int queueSizeLimit=100)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">RtMidiIn::RtMidiIn </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classRtMidi.html#aac66af04a85fe5c5f07c360574a19406">RtMidi::Api</a> </td>
<td class="paramname"> <em>api</em> = <code>UNSPECIFIED</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string </td>
<td class="paramname"> <em>clientName</em> = <code>std::string("RtMidi Input Client")</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>queueSizeLimit</em> = <code>100</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor that allows an optional api, client name and queue size. </p>
<p>An exception will be thrown if a MIDI system initialization error occurs. The queue size defines the maximum number of messages that can be held in the MIDI queue (when not using a callback function). If the queue size limit is reached, incoming messages will be ignored.</p>
<p>If no API argument is specified and multiple API support has been compiled, the default order of use is JACK, ALSA (Linux) and CORE, Jack (OS-X). </p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a39df8f81a22f729a9904707dde487d2c"></a><!-- doxytag: member="RtMidiIn::openPort" ref="a39df8f81a22f729a9904707dde487d2c" args="(unsigned int portNumber=0, const std::string portName=std::string("RtMidi Input"))" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void RtMidiIn::openPort </td>
<td>(</td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>portNumber</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string </td>
<td class="paramname"> <em>portName</em> = <code>std::string( "RtMidi Input" )</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open a MIDI input connection. </p>
<p>An optional port number greater than 0 can be specified. Otherwise, the default or first port found is opened. </p>
<p>Implements <a class="el" href="classRtMidi.html#ad9e30a89638f93193cb40edebaa536f5">RtMidi</a>.</p>
<p><div class="fragment"><pre class="fragment"><a name="l00427"></a>00427 { <span class="keywordflow">return</span> rtapi_->openPort( portNumber, portName ); }
</pre></div></p>
</div>
</div>
<a class="anchor" id="a245261b3f12ce727faed18fcfeef18c2"></a><!-- doxytag: member="RtMidiIn::openVirtualPort" ref="a245261b3f12ce727faed18fcfeef18c2" args="(const std::string portName=std::string("RtMidi Input"))" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void RtMidiIn::openVirtualPort </td>
<td>(</td>
<td class="paramtype">const std::string </td>
<td class="paramname"> <em>portName</em> = <code>std::string( "RtMidi Input" )</code></td>
<td> ) </td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Create a virtual input port, with optional name, to allow software connections (OS X and ALSA only). </p>
<p>This function creates a virtual MIDI input port to which other software applications can connect. This type of functionality is currently only supported by the Macintosh OS-X and Linux ALSA APIs (the function does nothing for the other APIs). </p>
<p>Implements <a class="el" href="classRtMidi.html#a9200cde4f5337c0bc421d20bd4fcf654">RtMidi</a>.</p>
<p><div class="fragment"><pre class="fragment"><a name="l00428"></a>00428 { <span class="keywordflow">return</span> rtapi_->openVirtualPort( portName ); }
</pre></div></p>
</div>
</div>
<a class="anchor" id="a7590563461c7467608a4b3806406b32d"></a><!-- doxytag: member="RtMidiIn::setCallback" ref="a7590563461c7467608a4b3806406b32d" args="(RtMidiCallback callback, void *userData=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void RtMidiIn::setCallback </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classRtMidiIn.html#a297d2eb3c3420b437970a6fc59d89cbf">RtMidiCallback</a> </td>
<td class="paramname"> <em>callback</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>userData</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set a callback function to be invoked for incoming MIDI messages. </p>
<p>The callback function will be called whenever an incoming MIDI message is received. While not absolutely necessary, it is best to set the callback function before opening a MIDI port to avoid leaving some messages in the queue. </p>
<p><div class="fragment"><pre class="fragment"><a name="l00430"></a>00430 { <span class="keywordflow">return</span> rtapi_->setCallback( callback, userData ); }
</pre></div></p>
</div>
</div>
<a class="anchor" id="ade23832a66c1ed56965c26325602543e"></a><!-- doxytag: member="RtMidiIn::cancelCallback" ref="ade23832a66c1ed56965c26325602543e" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void RtMidiIn::cancelCallback </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Cancel use of the current callback function (if one exists). </p>
<p>Subsequent incoming MIDI messages will be written to the queue and can be retrieved with the <em>getMessage</em> function. </p>
<p><div class="fragment"><pre class="fragment"><a name="l00431"></a>00431 { <span class="keywordflow">return</span> rtapi_->cancelCallback(); }
</pre></div></p>
</div>
</div>
<a class="anchor" id="af2961fff09fa01a3d5bc0f0c5a042aaf"></a><!-- doxytag: member="RtMidiIn::getPortName" ref="af2961fff09fa01a3d5bc0f0c5a042aaf" args="(unsigned int portNumber=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string RtMidiIn::getPortName </td>
<td>(</td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>portNumber</em> = <code>0</code></td>
<td> ) </td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return a string identifier for the specified MIDI input port number. </p>
<p>An empty string is returned if an invalid port specifier is provided. </p>
<p>Implements <a class="el" href="classRtMidi.html#a799e2b9f4df39b298518f2b394db3391">RtMidi</a>.</p>
<p><div class="fragment"><pre class="fragment"><a name="l00433"></a>00433 { <span class="keywordflow">return</span> rtapi_->getPortName( portNumber ); }
</pre></div></p>
</div>
</div>
<a class="anchor" id="af9507125aaa42276ccc01df576fc3533"></a><!-- doxytag: member="RtMidiIn::ignoreTypes" ref="af9507125aaa42276ccc01df576fc3533" args="(bool midiSysex=true, bool midiTime=true, bool midiSense=true)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void RtMidiIn::ignoreTypes </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>midiSysex</em> = <code>true</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>midiTime</em> = <code>true</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>midiSense</em> = <code>true</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Specify whether certain MIDI message types should be queued or ignored during input. </p>
<p>o By default, MIDI timing and active sensing messages are ignored during message input because of their relative high data rates. MIDI sysex messages are ignored by default as well. Variable values of "true" imply that the respective message type will be ignored. </p>
<p><div class="fragment"><pre class="fragment"><a name="l00434"></a>00434 { <span class="keywordflow">return</span> rtapi_->ignoreTypes( midiSysex, midiTime, midiSense ); }
</pre></div></p>
</div>
</div>
<a class="anchor" id="a1ba10ecd276b30a8579c7d60a9c890eb"></a><!-- doxytag: member="RtMidiIn::getMessage" ref="a1ba10ecd276b30a8579c7d60a9c890eb" args="(std::vector< unsigned char > *message)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double RtMidiIn::getMessage </td>
<td>(</td>
<td class="paramtype">std::vector< unsigned char > * </td>
<td class="paramname"> <em>message</em></td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Fill the user-provided vector with the data bytes for the next available MIDI message in the input queue and return the event delta-time in seconds. </p>
<p>This function returns immediately whether a new message is available or not. A valid message is indicated by a non-zero vector size. An exception is thrown if an error occurs during message retrieval or an input connection was not previously established. </p>
<p><div class="fragment"><pre class="fragment"><a name="l00435"></a>00435 { <span class="keywordflow">return</span> rtapi_->getMessage( message ); }
</pre></div></p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="RtMidi_8h_source.html">RtMidi.h</a></li>
</ul>
</div>
<HR>
<table>
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>
|