mirror of
https://github.com/thestk/stk
synced 2026-01-14 13:31:53 +00:00
242 lines
16 KiB
HTML
242 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"> <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.5.8 -->
|
|
<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" -->STK internet streaming input class.
|
|
<a href="#_details">More...</a>
|
|
<p>
|
|
<code>#include <<a class="el" href="InetWvIn_8h-source.html">InetWvIn.h</a>></code>
|
|
<p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for stk::InetWvIn:</div>
|
|
<div class="dynsection">
|
|
|
|
<p><center><img src="classstk_1_1InetWvIn.png" usemap="#stk::InetWvIn_map" border="0" alt=""></center>
|
|
<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>
|
|
|
|
<p>
|
|
<a href="classstk_1_1InetWvIn-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td></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="classstk_1_1InetWvIn.html#d97edafdfb9db2aee77b11d3086113a4">InetWvIn</a> (unsigned long bufferFrames=1024, unsigned int nBuffers=8)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#d97edafdfb9db2aee77b11d3086113a4"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="760628dfbbca0a11142d28ff5cabd8b5"></a><!-- doxytag: member="stk::InetWvIn::~InetWvIn" ref="760628dfbbca0a11142d28ff5cabd8b5" args="()" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#760628dfbbca0a11142d28ff5cabd8b5">~InetWvIn</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class destructor. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#f36ff382737f0fb84bc38046c01b4ce8">listen</a> (int port=2006, unsigned int nChannels=1, Stk::StkFormat format=<a class="el" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, Socket::ProtocolType protocol=Socket::PROTO_TCP)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Wait for a (new) socket connection with specified protocol, port, data channels and format. <a href="#f36ff382737f0fb84bc38046c01b4ce8"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#8b54226eabcd0c58d93fcc0792fa7e02">isConnected</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true is an input connection exists or input data remains in the queue. <a href="#8b54226eabcd0c58d93fcc0792fa7e02"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#cfd578027b2bbcbe4ceefa11e49e8cd2">lastOut</a> (unsigned int channel=0)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the specified channel value of the last computed frame. <a href="#cfd578027b2bbcbe4ceefa11e49e8cd2"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#2109090620c80013ef3ae68cb975fb17">tick</a> (unsigned int channel=0)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute a sample frame and return the specified <code>channel</code> value. <a href="#2109090620c80013ef3ae68cb975fb17"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1InetWvIn.html#3ccbdb9a4d54ac51ff999ea0ce350212">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &frames)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </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="#3ccbdb9a4d54ac51ff999ea0ce350212"></a><br></td></tr>
|
|
</table>
|
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
|
STK internet streaming input class.
|
|
<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>
|
|
<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#2109090620c80013ef3ae68cb975fb17" 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>
|
|
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>
|
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2009. <hr><h2>Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" name="d97edafdfb9db2aee77b11d3086113a4"></a><!-- doxytag: member="stk::InetWvIn::InetWvIn" ref="d97edafdfb9db2aee77b11d3086113a4" 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 </td>
|
|
<td class="paramname"> <em>bufferFrames</em> = <code>1024</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned int </td>
|
|
<td class="paramname"> <em>nBuffers</em> = <code>8</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.
|
|
<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.
|
|
</div>
|
|
</div><p>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<a class="anchor" name="f36ff382737f0fb84bc38046c01b4ce8"></a><!-- doxytag: member="stk::InetWvIn::listen" ref="f36ff382737f0fb84bc38046c01b4ce8" 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 </td>
|
|
<td class="paramname"> <em>port</em> = <code>2006</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned int </td>
|
|
<td class="paramname"> <em>nChannels</em> = <code>1</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">Stk::StkFormat </td>
|
|
<td class="paramname"> <em>format</em> = <code><a class="el" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a></code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">Socket::ProtocolType </td>
|
|
<td class="paramname"> <em>protocol</em> = <code>Socket::PROTO_TCP</code></td><td> </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>
|
|
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.
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="8b54226eabcd0c58d93fcc0792fa7e02"></a><!-- doxytag: member="stk::InetWvIn::isConnected" ref="8b54226eabcd0c58d93fcc0792fa7e02" 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 </td>
|
|
<td class="paramname"> </td>
|
|
<td> ) </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>
|
|
This method will not return false after an input connection has been closed until all buffered input data has been read out.
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="cfd578027b2bbcbe4ceefa11e49e8cd2"></a><!-- doxytag: member="stk::InetWvIn::lastOut" ref="cfd578027b2bbcbe4ceefa11e49e8cd2" 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 </td>
|
|
<td class="paramname"> <em>channel</em> = <code>0</code> </td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Return the specified channel value of the last computed frame.
|
|
<p>
|
|
For multi-channel files, use the <a class="el" href="classstk_1_1WvIn.html#3ab86e33eff9f962c9ef7b41e3ccb77e" 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.
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="2109090620c80013ef3ae68cb975fb17"></a><!-- doxytag: member="stk::InetWvIn::tick" ref="2109090620c80013ef3ae68cb975fb17" 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 </td>
|
|
<td class="paramname"> <em>channel</em> = <code>0</code> </td>
|
|
<td> ) </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>
|
|
For multi-channel files, use the <a class="el" href="classstk_1_1WvIn.html#3ab86e33eff9f962c9ef7b41e3ccb77e" 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>Implements <a class="el" href="classstk_1_1WvIn.html#0eda243730408a434856fffed776931e">stk::WvIn</a>.</p>
|
|
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="3ccbdb9a4d54ac51ff999ea0ce350212"></a><!-- doxytag: member="stk::InetWvIn::tick" ref="3ccbdb9a4d54ac51ff999ea0ce350212" args="(StkFrames &frames)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a>& stk::InetWvIn::tick </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td>
|
|
<td class="paramname"> <em>frames</em> </td>
|
|
<td> ) </td>
|
|
<td></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>
|
|
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#f36ff382737f0fb84bc38046c01b4ce8" 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).
|
|
</div>
|
|
</div><p>
|
|
<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></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>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|