Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


stk::InetWvOut Class Reference

STK internet streaming output class. More...

#include <InetWvOut.h>

Inheritance diagram for stk::InetWvOut:
stk::WvOut stk::Stk

List of all members.

Public Member Functions

 InetWvOut (unsigned long packetFrames=1024)
 Default constructor ... the socket is not instantiated.
 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.
 ~InetWvOut ()
 Class destructor.
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 format.
void disconnect (void)
 If a connection is open, write out remaining samples in the queue and then disconnect.
void tick (const StkFloat sample)
 Output a single sample to all channels in a sample frame.
void tick (const StkFrames &frames)
 Output the StkFrames data.

Detailed Description

STK internet streaming output class.

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

InetWvOut supports multi-channel data. It is important to distinguish the tick() method that outputs a single sample to all channels in a sample frame from the overloaded one that takes a reference to an StkFrames object for multi-channel and/or multi-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 - 2010.


Constructor & Destructor Documentation

stk::InetWvOut::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 StkError is thrown if a socket error occurs or an invalid argument is specified.


Member Function Documentation

void stk::InetWvOut::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 format.

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

void stk::InetWvOut::tick ( const StkFloat  sample  )  [virtual]

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

An StkError is thrown if an output error occurs. If a socket connection does not exist, the function does nothing (a warning will be issued if _STK_DEBUG_ is defined during compilation).

Implements stk::WvOut.

void stk::InetWvOut::tick ( const StkFrames frames  )  [virtual]

Output the StkFrames data.

An StkError will be thrown if an output error occurs. An StkError will also be thrown if _STK_DEBUG_ is defined during compilation and there is an incompatability between the number of channels in the FileWvOut object and that in the StkFrames object. If a socket connection does not exist, the function does nothing (a warning will be issued if _STK_DEBUG_ is defined during compilation).

Implements stk::WvOut.


The documentation for this class was generated from the following file:

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