File: classstk_1_1Messager.html

package info (click to toggle)
stk 4.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 24,856 kB
  • sloc: cpp: 33,976; tcl: 2,375; sh: 2,319; ansic: 163; perl: 114; makefile: 37
file content (178 lines) | stat: -rw-r--r-- 14,131 bytes parent folder | download | duplicates (2)
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
<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"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="faq.html">FAQ</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.6.2 -->
  <div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1Messager.html">Messager</a>
  </div>
<div class="contents">
<h1>stk::Messager Class Reference</h1><!-- doxytag: class="stk::Messager" --><!-- doxytag: inherits="stk::Stk" -->
<p>STK input control message parser.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="Messager_8h_source.html">Messager.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for stk::Messager:</div>
<div class="dynsection">
 <div class="center">
  <img src="classstk_1_1Messager.png" usemap="#stk::Messager_map" alt=""/>
  <map id="stk::Messager_map" name="stk::Messager_map">
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,89,24"/>
</map>
 </div>
</div>

<p><a href="classstk_1_1Messager-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa4c8f3396345157ccd19395258a253a9"></a><!-- doxytag: member="stk::Messager::Messager" ref="aa4c8f3396345157ccd19395258a253a9" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#aa4c8f3396345157ccd19395258a253a9">Messager</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8300dba83620cc86388780b5fa4080e0"></a><!-- doxytag: member="stk::Messager::~Messager" ref="a8300dba83620cc86388780b5fa4080e0" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#a8300dba83620cc86388780b5fa4080e0">~Messager</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Class destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#a18525952880382c25322e57353a34372">popMessage</a> (<a class="el" href="structstk_1_1Skini_1_1Message.html">Skini::Message</a> &amp;message)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pop the next message from the queue and write it to the referenced message structure.  <a href="#a18525952880382c25322e57353a34372"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae8b09328c103bffd180456bf57ee64b3"></a><!-- doxytag: member="stk::Messager::pushMessage" ref="ae8b09328c103bffd180456bf57ee64b3" args="(Skini::Message &amp;message)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#ae8b09328c103bffd180456bf57ee64b3">pushMessage</a> (<a class="el" href="structstk_1_1Skini_1_1Message.html">Skini::Message</a> &amp;message)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Push the referenced message onto the message stack. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#a172cf26bfebc8b4b12943e2bd76d5f72">setScoreFile</a> (const char *filename)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Specify a SKINI formatted scorefile from which messages should be read.  <a href="#a172cf26bfebc8b4b12943e2bd76d5f72"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#a04c70f97c899b03f3b7c1158943106e3">startStdInput</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initiate the "realtime" retreival from stdin of control messages into the queue.  <a href="#a04c70f97c899b03f3b7c1158943106e3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#a180fd45d109a2058ecbd6a629b979cb7">startSocketInput</a> (int port=2001)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start a socket server, accept connections, and read "realtime" control messages into the message queue.  <a href="#a180fd45d109a2058ecbd6a629b979cb7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Messager.html#a49877209a4ee08e684de82a73f2d9df9">startMidiInput</a> (int port=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start MIDI input, with optional device and port identifiers.  <a href="#a49877209a4ee08e684de82a73f2d9df9"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>STK input control message parser. </p>
<p>This class reads and parses control messages from a variety of sources, such as a scorefile, MIDI port, socket connection, or stdin. MIDI messages are retrieved using the <a class="el" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a> class. All other input sources (scorefile, socket, or stdin) are assumed to provide SKINI formatted messages. This class can be compiled with generic, non-realtime support, in which case only scorefile reading is possible.</p>
<p>The various <em>realtime</em> message acquisition mechanisms (from MIDI, socket, or stdin) take place asynchronously, filling the message queue. A call to <a class="el" href="classstk_1_1Messager.html#a18525952880382c25322e57353a34372" title="Pop the next message from the queue and write it to the referenced message structure...">popMessage()</a> will pop the next available control message from the queue and return it via the referenced Message structure. When a <em>non-realtime</em> scorefile is set, it is not possible to start reading realtime input messages (from MIDI, socket, or stdin). Likewise, it is not possible to read from a scorefile when a realtime input mechanism is running.</p>
<p>When MIDI input is started, input is also automatically read from stdin. This allows for program termination via the terminal window. An __SK_Exit_ message is pushed onto the stack whenever an "exit" or "Exit" message is received from stdin or when all socket connections close and no stdin thread is running.</p>
<p>This class is primarily for use in STK example programs but it is generic enough to work in many other contexts.</p>
<p>by Perry R. Cook and Gary P. Scavone, 1995-2012. </p>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a18525952880382c25322e57353a34372"></a><!-- doxytag: member="stk::Messager::popMessage" ref="a18525952880382c25322e57353a34372" args="(Skini::Message &amp;message)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void stk::Messager::popMessage </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structstk_1_1Skini_1_1Message.html">Skini::Message</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>message</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Pop the next message from the queue and write it to the referenced message structure. </p>
<p>Invalid messages (or an empty queue) are indicated by type values of zero, in which case all other message structure values are undefined. The user MUST verify the returned message type is valid before reading other message values. </p>

</div>
</div>
<a class="anchor" id="a172cf26bfebc8b4b12943e2bd76d5f72"></a><!-- doxytag: member="stk::Messager::setScoreFile" ref="a172cf26bfebc8b4b12943e2bd76d5f72" args="(const char *filename)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool stk::Messager::setScoreFile </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>filename</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Specify a SKINI formatted scorefile from which messages should be read. </p>
<p>A return value of <code>true</code> indicates the call was successful. A return value of <code>false</code> can occur if the file is not found, cannot be opened, another file is currently still open, or if a realtime input mechanism is running. Scorefile input is considered to be a non-realtime control mechanism that cannot run concurrently with realtime input. </p>

</div>
</div>
<a class="anchor" id="a04c70f97c899b03f3b7c1158943106e3"></a><!-- doxytag: member="stk::Messager::startStdInput" ref="a04c70f97c899b03f3b7c1158943106e3" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool stk::Messager::startStdInput </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initiate the "realtime" retreival from stdin of control messages into the queue. </p>
<p>This function initiates a thread for asynchronous retrieval of SKINI formatted messages from stdin. A return value of <code>true</code> indicates the call was successful. A return value of <code>false</code> can occur if a scorefile is being read, a stdin thread is already running, or a thread error occurs during startup. Stdin input is considered to be a realtime control mechanism that cannot run concurrently with non-realtime scorefile input. </p>

</div>
</div>
<a class="anchor" id="a180fd45d109a2058ecbd6a629b979cb7"></a><!-- doxytag: member="stk::Messager::startSocketInput" ref="a180fd45d109a2058ecbd6a629b979cb7" args="(int port=2001)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool stk::Messager::startSocketInput </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>port</em> = <code>2001</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Start a socket server, accept connections, and read "realtime" control messages into the message queue. </p>
<p>This function creates a socket server on the optional port (default = 2001) and starts a thread for asynchronous retrieval of SKINI formatted messages from socket connections. A return value of <code>true</code> indicates the call was successful. A return value of <code>false</code> can occur if a scorefile is being read, a socket thread is already running, or an error occurs during the socket server or thread initialization stages. <a class="el" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> input is considered to be a realtime control mechanism that cannot run concurrently with non-realtime scorefile input. </p>

</div>
</div>
<a class="anchor" id="a49877209a4ee08e684de82a73f2d9df9"></a><!-- doxytag: member="stk::Messager::startMidiInput" ref="a49877209a4ee08e684de82a73f2d9df9" args="(int port=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool stk::Messager::startMidiInput </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>port</em> = <code>0</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Start MIDI input, with optional device and port identifiers. </p>
<p>This function creates an <a class="el" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> instance for MIDI input. The <a class="el" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> class invokes a local callback function to read incoming messages into the queue. If <code>port</code> = -1, <a class="el" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> will open a virtual port to which other software applications can connect (OS X and Linux only). A return value of <code>true</code> indicates the call was successful. A return value of <code>false</code> can occur if a scorefile is being read, MIDI input is already running, or an error occurs during <a class="el" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> construction. Midi input is considered to be a realtime control mechanism that cannot run concurrently with non-realtime scorefile input. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Messager_8h_source.html">Messager.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>&copy;1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>

</BODY>
</HTML>