Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SpeakerServer Class Reference

Plays streamed audio via the speaker. More...

#include <SpeakerServer.h>

Inheritance diagram for SpeakerServer:

Detailed Description

Plays streamed audio via the speaker.

Definition at line 9 of file SpeakerServer.h.

List of all members.

Classes

class  Packet
 stores information about current sound buffer More...

Public Member Functions

virtual ~SpeakerServer ()
 destructor
virtual void doStart ()
 Delegate function for subclasses to be notified when the behavior starts up.
virtual void doStop ()
 Delegate function for subclasses to be notified when the behavior starts up.

Static Public Member Functions

static SpeakerServergetInstance ()
 returns global instance
static int socket_callback (char *buf, int size)
 registered by doStart() to be called by networking module with incoming data

Private Member Functions

 SpeakerServer ()
 constructor
 SpeakerServer (const SpeakerServer &rhs)
 don't call
SpeakerServeroperator= (const SpeakerServer &rhs)
 don't call
int GotSocketData (char *data, int dataSize)
 should be called with new sound data from the network
void AddPacket (const void *samples, int samplesSize, int sampleRate, byte sampleBits)
const void * ResampleForSpeaker (const void *samples, int samplesSize, int sampleRate, byte bitsPerSample, int &newSamplesSize)
void QueueFrame (const char *samples, int samplesSize)

Static Private Member Functions

static short GetShort (const void *buf)
 returns the next sizeof(short) bytes from buf as a short

Private Attributes

class Socketsocket
Packet packet
class Bufferframe
class Bufferresampled
SoundManager::Play_ID channel

Static Private Attributes

static SpeakerServerinstance
 global instance of the server (only ever want to have one of these)
static const int MAX_PACKET_SIZE = 1024 * 1024
 maximum size of sound buffer to send to system
static const int RECEIVE_BUFFER_SIZE = 2048
 maximum network packet size to accept

Constructor & Destructor Documentation

virtual SpeakerServer::~SpeakerServer (  )  [virtual]

destructor

SpeakerServer::SpeakerServer (  )  [private]

constructor

SpeakerServer::SpeakerServer ( const SpeakerServer rhs  )  [private]

don't call


Member Function Documentation

void SpeakerServer::AddPacket ( const void *  samples,
int  samplesSize,
int  sampleRate,
byte  sampleBits 
) [private]
virtual void SpeakerServer::doStart (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

Should be overridden by subclasses to subscribe to events, install motion commands, etc.

doStart() is basically a hook to allow subclasses to jump in and do some customization of behavior parameters while the behavior is starting. If you are writing a behavior class and do not expect further derivation, just override doStart() yourself. However, if you do expect further derivation of your class, consider using preStart() or postStart() instead, and leave doStart() for the 'leaf' classes.

Reimplemented from BehaviorBase.

virtual void SpeakerServer::doStop (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

May be overridden to cleanup when the behavior is shutting down. However events will automatically be unsubscribed, and by using addMotion(), motions will automatically be removed by stop(), so you may not need any cleanup.

Reimplemented from BehaviorBase.

static SpeakerServer& SpeakerServer::getInstance (  )  [static]

returns global instance

static short SpeakerServer::GetShort ( const void *  buf  )  [static, private]

returns the next sizeof(short) bytes from buf as a short

Definition at line 29 of file SpeakerServer.h.

int SpeakerServer::GotSocketData ( char *  data,
int  dataSize 
) [private]

should be called with new sound data from the network

SpeakerServer& SpeakerServer::operator= ( const SpeakerServer rhs  )  [private]

don't call

void SpeakerServer::QueueFrame ( const char *  samples,
int  samplesSize 
) [private]
const void* SpeakerServer::ResampleForSpeaker ( const void *  samples,
int  samplesSize,
int  sampleRate,
byte  bitsPerSample,
int &  newSamplesSize 
) [private]
static int SpeakerServer::socket_callback ( char *  buf,
int  size 
) [static]

registered by doStart() to be called by networking module with incoming data


Member Data Documentation

Definition at line 74 of file SpeakerServer.h.

class Buffer* SpeakerServer::frame [private]

Definition at line 57 of file SpeakerServer.h.

global instance of the server (only ever want to have one of these)

Definition at line 24 of file SpeakerServer.h.

const int SpeakerServer::MAX_PACKET_SIZE = 1024 * 1024 [static, private]

maximum size of sound buffer to send to system

Definition at line 31 of file SpeakerServer.h.

Definition at line 56 of file SpeakerServer.h.

const int SpeakerServer::RECEIVE_BUFFER_SIZE = 2048 [static, private]

maximum network packet size to accept

Definition at line 32 of file SpeakerServer.h.

class Buffer* SpeakerServer::resampled [private]

Definition at line 58 of file SpeakerServer.h.

class Socket* SpeakerServer::socket [private]

network communications socket for receiving sound data

Definition at line 27 of file SpeakerServer.h.


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:17 2016 by Doxygen 1.6.3