Files
stk/doc/html/classstk_1_1InetWvIn.html
2013-09-29 23:48:48 +02:00

232 lines
16 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"> &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_1InetWvIn.html">InetWvIn</a>
</div>
<div class="contents">
<h1>stk::InetWvIn Class Reference</h1><!-- doxytag: class="stk::InetWvIn" --><!-- doxytag: inherits="stk::WvIn" -->
<p>STK internet streaming input class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="InetWvIn_8h_source.html">InetWvIn.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for stk::InetWvIn:</div>
<div class="dynsection">
<div class="center">
<img src="classstk_1_1InetWvIn.png" usemap="#stk::InetWvIn_map" alt=""/>
<map id="stk::InetWvIn_map" name="stk::InetWvIn_map">
<area href="classstk_1_1WvIn.html" alt="stk::WvIn" shape="rect" coords="0,56,81,80"/>
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,81,24"/>
</map>
</div>
</div>
<p><a href="classstk_1_1InetWvIn-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">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#ad97edafdfb9db2aee77b11d3086113a4">InetWvIn</a> (unsigned long bufferFrames=1024, unsigned int nBuffers=8)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <a href="#ad97edafdfb9db2aee77b11d3086113a4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a760628dfbbca0a11142d28ff5cabd8b5"></a><!-- doxytag: member="stk::InetWvIn::~InetWvIn" ref="a760628dfbbca0a11142d28ff5cabd8b5" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#a760628dfbbca0a11142d28ff5cabd8b5">~InetWvIn</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_1InetWvIn.html#af36ff382737f0fb84bc38046c01b4ce8">listen</a> (int port=2006, unsigned int nChannels=1, Stk::StkFormat format=<a class="el" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, Socket::ProtocolType protocol=Socket::PROTO_TCP)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wait for a (new) socket connection with specified protocol, port, data channels and format. <a href="#af36ff382737f0fb84bc38046c01b4ce8"></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_1InetWvIn.html#a8b54226eabcd0c58d93fcc0792fa7e02">isConnected</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true is an input connection exists or input data remains in the queue. <a href="#a8b54226eabcd0c58d93fcc0792fa7e02"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2">lastOut</a> (unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the specified channel value of the last computed frame. <a href="#acfd578027b2bbcbe4ceefa11e49e8cd2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#a2109090620c80013ef3ae68cb975fb17">tick</a> (unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compute a sample frame and return the specified <code>channel</code> value. <a href="#a2109090620c80013ef3ae68cb975fb17"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#a3ccbdb9a4d54ac51ff999ea0ce350212">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;frames)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Fill the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument with computed frames and return the same reference. <a href="#a3ccbdb9a4d54ac51ff999ea0ce350212"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>STK internet streaming input class. </p>
<p>This Wvin subclass reads streamed audio data over a network via a TCP or UDP socket connection. The data is assumed in big-endian, or network, byte order. Only a single socket connection is supported.</p>
<p><a class="el" href="classstk_1_1InetWvIn.html" title="STK internet streaming input class.">InetWvIn</a> supports multi-channel data. It is important to distinguish the <a class="el" href="classstk_1_1InetWvIn.html#a2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick()</a> method that computes a single frame (and returns only the specified sample of a multi-channel frame) from the overloaded one that takes an <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object for multi-channel and/or multi-frame data.</p>
<p>This class implements a socket server. When using the TCP protocol, the server "listens" for a single remote connection within the InetWvIn::start() function. For the UDP protocol, no attempt is made to verify packet delivery or order. The default data type for the incoming stream is signed 16-bit integers, though any of the defined StkFormats are permissible.</p>
<p>by Perry R. Cook and Gary P. Scavone, 1995 - 2010. </p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ad97edafdfb9db2aee77b11d3086113a4"></a><!-- doxytag: member="stk::InetWvIn::InetWvIn" ref="ad97edafdfb9db2aee77b11d3086113a4" args="(unsigned long bufferFrames=1024, unsigned int nBuffers=8)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">stk::InetWvIn::InetWvIn </td>
<td>(</td>
<td class="paramtype">unsigned long&nbsp;</td>
<td class="paramname"> <em>bufferFrames</em> = <code>1024</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>nBuffers</em> = <code>8</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor. </p>
<p>An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if an error occurs while initializing the input thread. </p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="af36ff382737f0fb84bc38046c01b4ce8"></a><!-- doxytag: member="stk::InetWvIn::listen" ref="af36ff382737f0fb84bc38046c01b4ce8" args="(int port=2006, unsigned int nChannels=1, Stk::StkFormat format=STK_SINT16, Socket::ProtocolType protocol=Socket::PROTO_TCP)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::InetWvIn::listen </td>
<td>(</td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>port</em> = <code>2006</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>nChannels</em> = <code>1</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Stk::StkFormat&nbsp;</td>
<td class="paramname"> <em>format</em> = <code><a class="el" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a></code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Socket::ProtocolType&nbsp;</td>
<td class="paramname"> <em>protocol</em> = <code>Socket::PROTO_TCP</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Wait for a (new) socket connection with specified protocol, port, data channels and format. </p>
<p>For the UDP protocol, this function will create a socket instance and return. For the TCP protocol, this function will block until a connection is established. An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if a socket error occurs or an invalid function argument is provided. </p>
</div>
</div>
<a class="anchor" id="a8b54226eabcd0c58d93fcc0792fa7e02"></a><!-- doxytag: member="stk::InetWvIn::isConnected" ref="a8b54226eabcd0c58d93fcc0792fa7e02" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool stk::InetWvIn::isConnected </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns true is an input connection exists or input data remains in the queue. </p>
<p>This method will not return false after an input connection has been closed until all buffered input data has been read out. </p>
</div>
</div>
<a class="anchor" id="acfd578027b2bbcbe4ceefa11e49e8cd2"></a><!-- doxytag: member="stk::InetWvIn::lastOut" ref="acfd578027b2bbcbe4ceefa11e49e8cd2" args="(unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">StkFloat stk::InetWvIn::lastOut </td>
<td>(</td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>channel</em> = <code>0</code></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the specified channel value of the last computed frame. </p>
<p>For multi-channel files, use the <a class="el" href="classstk_1_1WvIn.html#a3ab86e33eff9f962c9ef7b41e3ccb77e" title="Return an StkFrames reference to the last computed sample frame.">lastFrame()</a> function to get all values from the last computed frame. If no connection exists, the returned value is 0.0. The <code>channel</code> argument must be less than the number of channels in the data stream (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception. </p>
</div>
</div>
<a class="anchor" id="a2109090620c80013ef3ae68cb975fb17"></a><!-- doxytag: member="stk::InetWvIn::tick" ref="a2109090620c80013ef3ae68cb975fb17" args="(unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">StkFloat stk::InetWvIn::tick </td>
<td>(</td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>channel</em> = <code>0</code></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Compute a sample frame and return the specified <code>channel</code> value. </p>
<p>For multi-channel files, use the <a class="el" href="classstk_1_1WvIn.html#a3ab86e33eff9f962c9ef7b41e3ccb77e" title="Return an StkFrames reference to the last computed sample frame.">lastFrame()</a> function to get all values from the computed frame. If no connection exists, the returned value is 0.0 (and a warning will be issued if _STK_DEBUG_ is defined during compilation). The <code>channel</code> argument must be less than the number of channels in the data stream (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception. </p>
<p>Implements <a class="el" href="classstk_1_1WvIn.html#a0eda243730408a434856fffed776931e">stk::WvIn</a>.</p>
</div>
</div>
<a class="anchor" id="a3ccbdb9a4d54ac51ff999ea0ce350212"></a><!-- doxytag: member="stk::InetWvIn::tick" ref="a3ccbdb9a4d54ac51ff999ea0ce350212" args="(StkFrames &amp;frames)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a>&amp; stk::InetWvIn::tick </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td>
<td class="paramname"> <em>frames</em></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Fill the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument with computed frames and return the same reference. </p>
<p>The number of channels in the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument must equal the number of channels specified in the <a class="el" href="classstk_1_1InetWvIn.html#af36ff382737f0fb84bc38046c01b4ce8" title="Wait for a (new) socket connection with specified protocol, port, data channels and...">listen()</a> function. However, this is only checked if _STK_DEBUG_ is defined during compilation, in which case an incompatibility will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception. If no connection exists, the function does nothing (a warning will be issued if _STK_DEBUG_ is defined during compilation). </p>
<p>Implements <a class="el" href="classstk_1_1WvIn.html#a76718752b0cc1ab767ba4e70d72b9453">stk::WvIn</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="InetWvIn_8h_source.html">InetWvIn.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-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>