Arduino STK  4.6.2
InetWvOut.h
1 
2 #include "Mutex.h"
3 #ifdef STK_MUTEXT_SUPPORTED
4 
5 #ifndef STK_INETWVOUT_H
6 #define STK_INETWVOUT_H
7 
8 #include "WvOut.h"
9 #include "Socket.h"
10 
11 namespace stk {
12 
13 /***************************************************/
34 /***************************************************/
35 
36 class InetWvOut : public WvOut
37 {
38  public:
40  InetWvOut( unsigned long packetFrames = 1024 );
41 
43 
46  InetWvOut( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
47  std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16,
48  unsigned long packetFrames = 1024 );
49 
52 
54 
57  void connect( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
58  std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16 );
59 
61  void disconnect( void );
62 
64 
69  void tick( const StkFloat sample );
70 
72 
81  void tick( const StkFrames& frames );
82 
83  protected:
84 
85  void incrementFrame( void );
86 
87  // Write a buffer of length frames via the socket connection.
88  void writeData( unsigned long frames );
89 
90  char *buffer_;
91  Socket *soket_;
92  unsigned long bufferFrames_;
93  unsigned long bufferBytes_;
94  unsigned long bufferIndex_;
95  unsigned long iData_;
96  unsigned int dataBytes_;
97  Stk::StkFormat dataType_;
98 };
99 
100 } // stk namespace
101 
102 #endif
103 #endif
STK internet streaming output class.
Definition: InetWvOut.h:37
void tick(const StkFrames &frames)
Output the StkFrames data.
void disconnect(void)
If a connection is open, write out remaining samples in the queue and then disconnect.
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...
void tick(const StkFloat sample)
Output a single sample to all channels in a sample frame.
InetWvOut(unsigned long packetFrames=1024)
Default constructor ... the socket is not instantiated.
~InetWvOut()
Class destructor.
InetWvOut(int port, Socket::ProtocolType protocol=Socket::PROTO_TCP, std::string hostname="localhost", unsigned int nChannels=1, Stk::StkFormat format=STK_SINT16, unsigned long packetFrames=1024)
Overloaded constructor which opens a network connection during instantiation.
An STK class to handle vectorized audio data.
Definition: Stk.h:287
static const StkFormat STK_SINT16
Definition: Stk.h:149
STK audio output abstract base class.
Definition: WvOut.h:23
The STK namespace.
Definition: ADSR.h:8