Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


InetWvOut.h
1 #ifndef STK_INETWVOUT_H
2 #define STK_INETWVOUT_H
3 
4 #include "WvOut.h"
5 #include "Socket.h"
6 
7 namespace stk {
8 
9 /***************************************************/
30 /***************************************************/
31 
32 class InetWvOut : public WvOut
33 {
34  public:
36  InetWvOut( unsigned long packetFrames = 1024 );
37 
39 
42  InetWvOut( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
43  std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16,
44  unsigned long packetFrames = 1024 );
45 
47  ~InetWvOut();
48 
50 
53  void connect( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
54  std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16 );
55 
57  void disconnect( void );
58 
60 
65  void tick( const StkFloat sample );
66 
68 
77  void tick( const StkFrames& frames );
78 
79  protected:
80 
81  void incrementFrame( void );
82 
83  // Write a buffer of length frames via the socket connection.
84  void writeData( unsigned long frames );
85 
86  char *buffer_;
87  Socket *soket_;
88  unsigned long bufferFrames_;
89  unsigned long bufferBytes_;
90  unsigned long bufferIndex_;
91  unsigned long iData_;
92  unsigned int dataBytes_;
93  Stk::StkFormat dataType_;
94 };
95 
96 } // stk namespace
97 
98 #endif
stk::Socket
STK internet socket abstract base class.
Definition: Socket.h:38
stk::InetWvOut::disconnect
void disconnect(void)
If a connection is open, write out remaining samples in the queue and then disconnect.
stk::InetWvOut::tick
void tick(const StkFloat sample)
Output a single sample to all channels in a sample frame.
stk::StkFrames
An STK class to handle vectorized audio data.
Definition: Stk.h:275
stk::InetWvOut::~InetWvOut
~InetWvOut()
Class destructor.
stk::InetWvOut::connect
void connect(int port, Socket::ProtocolType protocol=Socket::PROTO_TCP, std::string hostname="localhost", unsigned int nChannels=1, Stk::StkFormat format=STK_SINT16)
Connect to the specified host and port and prepare to stream nChannels of data in the given data form...
stk::Stk::STK_SINT16
static const StkFormat STK_SINT16
Definition: Stk.h:138
stk::InetWvOut
STK internet streaming output class.
Definition: InetWvOut.h:32
stk::WvOut
STK audio output abstract base class.
Definition: WvOut.h:22
stk::InetWvOut::InetWvOut
InetWvOut(unsigned long packetFrames=1024)
Default constructor ... the socket is not instantiated.
stk
The STK namespace.
Definition: ADSR.h:6

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