Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
00001 /***************************************************/ 00025 /***************************************************/ 00026 00027 #ifndef STK_INETWVIN_H 00028 #define STK_INETWVIN_H 00029 00030 #include "WvIn.h" 00031 #include "TcpServer.h" 00032 #include "UdpSocket.h" 00033 #include "Thread.h" 00034 #include "Mutex.h" 00035 00036 typedef struct { 00037 bool finished; 00038 void *object; 00039 } ThreadInfo; 00040 00041 class InetWvIn : public WvIn 00042 { 00043 public: 00045 00048 InetWvIn( unsigned long bufferFrames = 1024, unsigned int nBuffers = 8 ); 00049 00051 ~InetWvIn(); 00052 00054 00061 void listen( int port = 2006, unsigned int nChannels = 1, 00062 Stk::StkFormat format = STK_SINT16, 00063 Socket::ProtocolType protocol = Socket::PROTO_TCP ); 00064 00066 00070 bool isConnected( void ); 00071 00072 // Called by the thread routine to receive data via the socket connection 00073 // and fill the socket buffer. This is not intended for general use but 00074 // had to be made public for access from the thread. 00075 void receive( void ); 00076 00077 protected: 00078 00079 // Read buffered socket data into the data buffer ... will block if none available. 00080 int readData( void ); 00081 00082 void computeFrame( void ); 00083 00084 Socket *soket_; 00085 Thread thread_; 00086 Mutex mutex_; 00087 char *buffer_; 00088 unsigned long bufferFrames_; 00089 unsigned long bufferBytes_; 00090 unsigned long bytesFilled_; 00091 unsigned int nBuffers_; 00092 unsigned long writePoint_; 00093 unsigned long readPoint_; 00094 long bufferCounter_; 00095 int dataBytes_; 00096 bool connected_; 00097 int fd_; 00098 ThreadInfo threadInfo_; 00099 Stk::StkFormat dataType_; 00100 00101 }; 00102 00103 #endif
The Synthesis ToolKit in C++ (STK) |
©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |