Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


InetWvOut.h

00001 /***************************************************/
00021 /***************************************************/
00022 
00023 #ifndef STK_INETWVOUT_H
00024 #define STK_INETWVOUT_H
00025 
00026 #include "WvOut.h"
00027 #include "Socket.h"
00028 
00029 class InetWvOut : public WvOut
00030 {
00031  public:
00033   InetWvOut( unsigned long packetFrames = 1024 );
00034 
00036 
00039   InetWvOut( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
00040              std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16,
00041              unsigned long packetFrames = 1024 );
00042 
00044   ~InetWvOut();
00045 
00047 
00050   void connect( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
00051                 std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16 );
00052 
00054   void disconnect(void);
00055 
00056  protected:
00057 
00058   void computeSample( const StkFloat sample );
00059 
00060   void computeFrames( const StkFrames& frames );
00061 
00062   void incrementFrame( void );
00063 
00064   // Write a buffer of length frames via the socket connection.
00065   void writeData( unsigned long frames );
00066 
00067   char *buffer_;
00068   Socket *soket_;
00069   unsigned long bufferFrames_;
00070   unsigned long bufferBytes_;
00071   unsigned long bufferIndex_;
00072   unsigned long iData_;
00073   unsigned int dataBytes_;
00074   Stk::StkFormat dataType_;
00075 };
00076 
00077 #endif

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