mirror of
https://github.com/thestk/stk
synced 2026-01-12 04:21:52 +00:00
390 lines
17 KiB
HTML
390 lines
17 KiB
HTML
<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="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.3.4 -->
|
|
<h1>RtMidiIn Class Reference</h1><code>#include <<a class="el" href="RtMidi_8h-source.html">RtMidi.h</a>></code>
|
|
<p>
|
|
<p>Inheritance diagram for RtMidiIn:
|
|
<p><center><img src="classRtMidiIn.png" usemap="#RtMidiIn_map" border="0" alt=""></center>
|
|
<map name="RtMidiIn_map">
|
|
<area href="classRtMidi.html" alt="RtMidi" shape="rect" coords="0,0,57,24">
|
|
</map>
|
|
<a href="classRtMidiIn-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
|
|
A realtime MIDI input class.
|
|
<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#a11">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>
|
|
by Gary P. Scavone, 2003-2004.
|
|
<p>
|
|
|
|
<p>
|
|
Definition at line <a class="el" href="RtMidi_8h-source.html#l00087">87</a> of file <a class="el" href="RtMidi_8h-source.html">RtMidi.h</a>.<table border=0 cellpadding=0 cellspacing=0>
|
|
<tr><td></td></tr>
|
|
<tr><td colspan=2><br><h2>Public Types</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="w0" doxytag="RtMidiIn::RtMidiCallback" ></a>
|
|
typedef void(* </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#w0">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><br></td></tr>
|
|
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a0">RtMidiIn</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. </em> <a href="#a0"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a1" doxytag="RtMidiIn::~RtMidiIn" ></a>
|
|
</td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a1">~RtMidiIn</a> ()</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><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a2">openPort</a> (unsigned int portNumber=0)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Open a MIDI input connection. </em> <a href="#a2"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a3">openVirtualPort</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a virtual input port to allow software connections (OS X and ALSA only). </em> <a href="#a3"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a4">setCallback</a> (<a class="el" href="classRtMidiIn.html#w0">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. </em> <a href="#a4"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a5">cancelCallback</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Cancel use of the current callback function (if one exists). </em> <a href="#a5"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a6" doxytag="RtMidiIn::closePort" ></a>
|
|
void </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a6">closePort</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Close an open MIDI connection (if one exists). <br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a7" doxytag="RtMidiIn::getPortCount" ></a>
|
|
unsigned int </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a7">getPortCount</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the number of available MIDI input ports. <br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a8">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. </em> <a href="#a8"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a9">setQueueSizeLimit</a> (unsigned int queueSize)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the maximum number of MIDI messages to be saved in the queue. </em> <a href="#a9"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a10">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. </em> <a href="#a10"></a><em><br><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>double </td><td class="memItemRight" valign=bottom><a class="el" href="classRtMidiIn.html#a11">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. </em> <a href="#a11"></a><em><br><br></td></tr>
|
|
</table>
|
|
<hr><h2>Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" name="a0" doxytag="RtMidiIn::RtMidiIn" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> RtMidiIn::RtMidiIn </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="mdname1" valign="top" nowrap> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Default constructor.
|
|
<p>
|
|
An exception will be thrown if a MIDI system initialization error occurs. </td>
|
|
</tr>
|
|
</table>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<a class="anchor" name="a2" doxytag="RtMidiIn::openPort" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> void RtMidiIn::openPort </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">unsigned int </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>portNumber</em> = 0 </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap><code> [virtual]</code></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Open a MIDI input connection.
|
|
<p>
|
|
An optional port number greater than 0 can be specified. Otherwise, the default or first port found is opened.
|
|
<p>
|
|
Implements <a class="el" href="classRtMidi.html">RtMidi</a>. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a3" doxytag="RtMidiIn::openVirtualPort" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> void RtMidiIn::openVirtualPort </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="mdname1" valign="top" nowrap> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Create a virtual input port to allow software connections (OS X and ALSA only).
|
|
<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). </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a4" doxytag="RtMidiIn::setCallback" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> void RtMidiIn::setCallback </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top"><a class="el" href="classRtMidiIn.html#w0">RtMidiCallback</a> </td>
|
|
<td class="mdname" nowrap> <em>callback</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="md" nowrap>void * </td>
|
|
<td class="mdname" nowrap> <em>userData</em> = 0</td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td class="md">) </td>
|
|
<td class="md" colspan="2"></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set a callback function to be invoked for incoming MIDI messages.
|
|
<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. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a5" doxytag="RtMidiIn::cancelCallback" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> void RtMidiIn::cancelCallback </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="mdname1" valign="top" nowrap> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Cancel use of the current callback function (if one exists).
|
|
<p>
|
|
Subsequent incoming MIDI messages will be written to the queue and can be retrieved with the <em>getMessage</em> function. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a8" doxytag="RtMidiIn::getPortName" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> std::string RtMidiIn::getPortName </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">unsigned int </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>portNumber</em> = 0 </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Return a string identifier for the specified MIDI input port number.
|
|
<p>
|
|
An exception is thrown if an invalid port specifier is provided. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a9" doxytag="RtMidiIn::setQueueSizeLimit" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> void RtMidiIn::setQueueSizeLimit </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">unsigned int </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>queueSize</em> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set the maximum number of MIDI messages to be saved in the queue.
|
|
<p>
|
|
If the queue size limit is reached, incoming messages will be ignored. The default limit is 1024. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a10" doxytag="RtMidiIn::ignoreTypes" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> void RtMidiIn::ignoreTypes </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">bool </td>
|
|
<td class="mdname" nowrap> <em>midiSysex</em> = true, </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="md" nowrap>bool </td>
|
|
<td class="mdname" nowrap> <em>midiTime</em> = true, </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="md" nowrap>bool </td>
|
|
<td class="mdname" nowrap> <em>midiSense</em> = true</td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td class="md">) </td>
|
|
<td class="md" colspan="2"></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Specify whether certain MIDI message types should be queued or ignored during input.
|
|
<p>
|
|
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. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a11" doxytag="RtMidiIn::getMessage" ></a><p>
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"> double RtMidiIn::getMessage </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">std::vector< unsigned char > * </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>message</em> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<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>
|
|
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. </td>
|
|
</tr>
|
|
</table>
|
|
<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></ul>
|
|
<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-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|