|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <HTML>
- <HEAD>
- <TITLE>The RtMidi Tutorial</TITLE>
- <LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
- </HEAD>
- <BODY BGCOLOR="#FFFFFF">
- <CENTER>
- <a class="qindex" href="index.html">Tutorial</a> <a class="qindex" href="annotated.html">Class/Enum List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</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>
-
- </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>
-
- </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>
-
- </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>
-
- </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>
-
- </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>
-
- </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>
-
- </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><img src="../images/mcgill.gif" width=165></td>
- <td>©2003-2012 Gary P. Scavone, McGill University. All Rights Reserved.<br>
- Maintained by Gary P. Scavone, gary at music.mcgill.ca</td></tr>
- </table>
-
- </BODY>
- </HTML>
|