Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


InetWvOut.h

00001 #ifndef STK_INETWVOUT_H
00002 #define STK_INETWVOUT_H
00003 
00004 #include "WvOut.h"
00005 #include "Socket.h"
00006 
00007 namespace stk {
00008 
00009 /***************************************************/
00030 /***************************************************/
00031 
00032 class InetWvOut : public WvOut
00033 {
00034  public:
00036   InetWvOut( unsigned long packetFrames = 1024 );
00037 
00039 
00042   InetWvOut( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
00043              std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16,
00044              unsigned long packetFrames = 1024 );
00045 
00047   ~InetWvOut();
00048 
00050 
00053   void connect( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
00054                 std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16 );
00055 
00057   void disconnect( void );
00058 
00060 
00065   void tick( const StkFloat sample );
00066 
00068 
00077   void tick( const StkFrames& frames );
00078 
00079  protected:
00080 
00081   void incrementFrame( void );
00082 
00083   // Write a buffer of length frames via the socket connection.
00084   void writeData( unsigned long frames );
00085 
00086   char *buffer_;
00087   Socket *soket_;
00088   unsigned long bufferFrames_;
00089   unsigned long bufferBytes_;
00090   unsigned long bufferIndex_;
00091   unsigned long iData_;
00092   unsigned int dataBytes_;
00093   Stk::StkFormat dataType_;
00094 };
00095 
00096 } // stk namespace
00097 
00098 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.