Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   Tutorial


TcpWvOut Class Reference

#include <TcpWvOut.h>

Inheritance diagram for TcpWvOut:

WvOut Stk List of all members.

Detailed Description

STK internet streaming output class.

This protected WvOut subclass can stream data over a network via a TCP socket connection. The data is converted to big-endian byte order, if necessary, before being transmitted.

TcpWvOut supports multi-channel data in interleaved format. It is important to distinguish the tick() methods, which output single samples to all channels in a sample frame, from the tickFrame() method, which takes a pointer to multi-channel sample frame data.

This class connects to a socket server, the port and IP address of which must be specified as constructor arguments. The default data type is signed 16-bit integers but any of the defined StkFormats are permissible.

by Perry R. Cook and Gary P. Scavone, 1995 - 2004.

Definition at line 34 of file TcpWvOut.h.

Public Member Functions

 TcpWvOut ()
 Default constructor ... the socket is not instantiated.

 TcpWvOut (int port, const char *hostname="localhost", unsigned int nChannels=1, Stk::StkFormat format=STK_SINT16)
 Overloaded constructor which opens a network connection during instantiation.

 ~TcpWvOut ()
 Class destructor.

void connect (int port, const char *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 format.

void disconnect (void)
 If a connection is open, write out remaining samples in the queue and then disconnect.

unsigned long getFrames (void) const
 Return the number of sample frames output.

StkFloat getTime (void) const
 Return the number of seconds of data output.

void tick (const StkFloat sample)
 Output a single sample to all channels in a sample frame.

void tick (const StkFloat *vector, unsigned int vectorSize)
 Output each sample in vector to all channels in vectorSize sample frames.

void tick (const StkFrames &frames, unsigned int channel=1)
 Output a channel of the StkFrames object to all channels of the TcpWvOut object.

void tickFrame (const StkFloat *frameVector, unsigned int frames=1)
 Output the frameVector of sample frames of the given length.

virtual void tickFrame (const StkFrames &frames)
 Output the StkFrames data to the TcpWvOut object.


Constructor & Destructor Documentation

TcpWvOut::TcpWvOut int  port,
const char *  hostname = "localhost",
unsigned int  nChannels = 1,
Stk::StkFormat  format = STK_SINT16
 

Overloaded constructor which opens a network connection during instantiation.

An StkError is thrown if a socket error occurs or an invalid argument is specified.


Member Function Documentation

void TcpWvOut::connect int  port,
const char *  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 format.

An StkError is thrown if a socket error occurs or an invalid argument is specified.

void TcpWvOut::tick const StkFloat  sample  )  [virtual]
 

Output a single sample to all channels in a sample frame.

An StkError is thrown if a socket write error occurs.

Reimplemented from WvOut.

void TcpWvOut::tick const StkFloat *  vector,
unsigned int  vectorSize
[virtual]
 

Output each sample in vector to all channels in vectorSize sample frames.

An StkError is thrown if a socket write error occurs.

Reimplemented from WvOut.

void TcpWvOut::tick const StkFrames frames,
unsigned int  channel = 1
[virtual]
 

Output a channel of the StkFrames object to all channels of the TcpWvOut object.

The channel argument should be one or greater (the first channel is specified by 1). An StkError will be thrown if a socket write error occurs or the channel argument is zero or it is greater than the number of channels in the StkFrames object.

Reimplemented from WvOut.

void TcpWvOut::tickFrame const StkFloat *  frameVector,
unsigned int  frames = 1
[virtual]
 

Output the frameVector of sample frames of the given length.

An StkError is thrown if a socket write error occurs.

Reimplemented from WvOut.

virtual void TcpWvOut::tickFrame const StkFrames frames  )  [virtual]
 

Output the StkFrames data to the TcpWvOut object.

An StkError will be thrown if a socket write error occurs or if there is an incompatability between the number of channels in the TcpWvOut object and that in the StkFrames object.

Reimplemented from WvOut.


The documentation for this class was generated from the following file:
The Synthesis ToolKit in C++ (STK)
©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.