mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
111 lines
8.8 KiB
HTML
111 lines
8.8 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="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.6.2 -->
|
|
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>Messager.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MESSAGER_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MESSAGER_H</span>
|
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
|
<a name="l00005"></a>00005 <span class="preprocessor">#include "Skini.h"</span>
|
|
<a name="l00006"></a>00006 <span class="preprocessor">#include <queue></span>
|
|
<a name="l00007"></a>00007
|
|
<a name="l00008"></a>00008 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
|
<a name="l00009"></a>00009 <span class="preprocessor"></span>
|
|
<a name="l00010"></a>00010 <span class="preprocessor">#include "Mutex.h"</span>
|
|
<a name="l00011"></a>00011 <span class="preprocessor">#include "Thread.h"</span>
|
|
<a name="l00012"></a>00012 <span class="preprocessor">#include "TcpServer.h"</span>
|
|
<a name="l00013"></a>00013 <span class="preprocessor">#include "RtMidi.h"</span>
|
|
<a name="l00014"></a>00014
|
|
<a name="l00015"></a>00015 <span class="preprocessor">#endif // __STK_REALTIME__</span>
|
|
<a name="l00016"></a>00016 <span class="preprocessor"></span>
|
|
<a name="l00017"></a>00017 <span class="keyword">namespace </span>stk {
|
|
<a name="l00018"></a>00018
|
|
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
|
<a name="l00051"></a>00051 <span class="comment">/***************************************************/</span>
|
|
<a name="l00052"></a>00052
|
|
<a name="l00053"></a>00053 <span class="keyword">const</span> <span class="keywordtype">int</span> DEFAULT_QUEUE_LIMIT = 200;
|
|
<a name="l00054"></a>00054
|
|
<a name="l00055"></a><a class="code" href="classstk_1_1Messager.html">00055</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Messager.html" title="STK input control message parser.">Messager</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
|
<a name="l00056"></a>00056 {
|
|
<a name="l00057"></a>00057 <span class="keyword">public</span>:
|
|
<a name="l00058"></a>00058
|
|
<a name="l00059"></a>00059 <span class="comment">// This structure is used to share data among the various realtime</span>
|
|
<a name="l00060"></a>00060 <span class="comment">// messager threads. It must be public.</span>
|
|
<a name="l00061"></a>00061 <span class="keyword">struct </span>MessagerData {
|
|
<a name="l00062"></a>00062 <a class="code" href="classstk_1_1Skini.html" title="STK SKINI parsing class.">Skini</a> skini;
|
|
<a name="l00063"></a>00063 std::queue<Skini::Message> queue;
|
|
<a name="l00064"></a>00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> queueLimit;
|
|
<a name="l00065"></a>00065 <span class="keywordtype">int</span> sources;
|
|
<a name="l00066"></a>00066
|
|
<a name="l00067"></a>00067 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
|
<a name="l00068"></a>00068 <span class="preprocessor"></span> <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex;
|
|
<a name="l00069"></a>00069 <a class="code" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> *midi;
|
|
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1TcpServer.html" title="STK TCP socket server class.">TcpServer</a> *socket;
|
|
<a name="l00071"></a>00071 std::vector<int> fd;
|
|
<a name="l00072"></a>00072 fd_set mask;
|
|
<a name="l00073"></a>00073 <span class="preprocessor">#endif</span>
|
|
<a name="l00074"></a>00074 <span class="preprocessor"></span>
|
|
<a name="l00075"></a>00075 <span class="comment">// Default constructor.</span>
|
|
<a name="l00076"></a>00076 MessagerData()
|
|
<a name="l00077"></a>00077 :queueLimit(0), sources(0) {}
|
|
<a name="l00078"></a>00078 };
|
|
<a name="l00079"></a>00079
|
|
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1Messager.html#aa4c8f3396345157ccd19395258a253a9" title="Default constructor.">Messager</a>();
|
|
<a name="l00082"></a>00082
|
|
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Messager.html#a8300dba83620cc86388780b5fa4080e0" title="Class destructor.">~Messager</a>();
|
|
<a name="l00085"></a>00085
|
|
<a name="l00087"></a>00087
|
|
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Messager.html#a18525952880382c25322e57353a34372" title="Pop the next message from the queue and write it to the referenced message structure...">popMessage</a>( <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
|
<a name="l00094"></a>00094
|
|
<a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Messager.html#ae8b09328c103bffd180456bf57ee64b3" title="Push the referenced message onto the message stack.">pushMessage</a>( <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
|
<a name="l00097"></a>00097
|
|
<a name="l00099"></a>00099
|
|
<a name="l00107"></a>00107 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#a172cf26bfebc8b4b12943e2bd76d5f72" title="Specify a SKINI formatted scorefile from which messages should be read.">setScoreFile</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* filename );
|
|
<a name="l00108"></a>00108
|
|
<a name="l00109"></a>00109 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
|
<a name="l00111"></a>00111 <span class="preprocessor"></span>
|
|
<a name="l00120"></a>00120 <span class="preprocessor"> bool startStdInput();</span>
|
|
<a name="l00121"></a>00121 <span class="preprocessor"></span>
|
|
<a name="l00123"></a>00123
|
|
<a name="l00134"></a>00134 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#a180fd45d109a2058ecbd6a629b979cb7" title="Start a socket server, accept connections, and read &quot;realtime&quot; control...">startSocketInput</a>( <span class="keywordtype">int</span> port=2001 );
|
|
<a name="l00135"></a>00135
|
|
<a name="l00137"></a>00137
|
|
<a name="l00149"></a>00149 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#a49877209a4ee08e684de82a73f2d9df9" title="Start MIDI input, with optional device and port identifiers.">startMidiInput</a>( <span class="keywordtype">int</span> port=0 );
|
|
<a name="l00150"></a>00150
|
|
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
|
<a name="l00152"></a>00152 <span class="preprocessor"></span>
|
|
<a name="l00153"></a>00153 <span class="keyword">protected</span>:
|
|
<a name="l00154"></a>00154
|
|
<a name="l00155"></a>00155 MessagerData data_;
|
|
<a name="l00156"></a>00156
|
|
<a name="l00157"></a>00157 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
|
<a name="l00158"></a>00158 <span class="preprocessor"></span> <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> stdinThread_;
|
|
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> socketThread_;
|
|
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
|
|
<a name="l00161"></a>00161 <span class="preprocessor"></span>
|
|
<a name="l00162"></a>00162 };
|
|
<a name="l00163"></a>00163
|
|
<a name="l00164"></a>00164 } <span class="comment">// stk namespace</span>
|
|
<a name="l00165"></a>00165
|
|
<a name="l00166"></a>00166 <span class="preprocessor">#endif</span>
|
|
</pre></div></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-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|