Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

MicrophoneServer Class Reference

Streams audio from the microphone over the network. More...

#include <MicrophoneServer.h>

Inheritance diagram for MicrophoneServer:

Detailed Description

Streams audio from the microphone over the network.

Definition at line 9 of file MicrophoneServer.h.

List of all members.

Public Member Functions

virtual ~MicrophoneServer ()
 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.
virtual void doEvent ()
 Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.

Static Public Member Functions

static MicrophoneServergetInstance ()
 enforces singleton status
static bool SetMicrophoneUnidirectional (bool unidirectional)
 makes Aperios-specific call to set microphone mode
static bool SetMicrophoneAlcEnabled (bool enabled)
 makes Aperios-specific call to set microphone mode

Private Member Functions

 MicrophoneServer ()
 constructor
 MicrophoneServer (const MicrophoneServer &rhs)
 don't call
MicrophoneServeroperator= (const MicrophoneServer &rhs)
 don't call
unsigned int GetResampledFrameSize (unsigned int samplesSize, unsigned int newSampleRate, unsigned int newSampleBits, bool newStereo)
 returns size of a "frame" at the given sampling rate and resolution
unsigned int ResampleFrame (const char *samples, unsigned int samplesSize, unsigned int &newSampleRate, unsigned int &newSampleBits, bool &newStereo, void *newSamples, unsigned int newSamplesSize)
 performs sampling to a specified rate and resolution, stores into newSamples (which you must allocate)

Static Private Member Functions

template<class T >
static void encode (char **dst, const T &value)
 writes value to dst and advances dst
template<class T >
static void encode (char **dst, const T *src, int num)
 writes length bytes from src to dst

Private Attributes

class Socketsocket
 socket for communication

Static Private Attributes

static const unsigned int SEND_BUFFER_SIZE = 2048 + 16
 max transmission buffer size for socket
static MicrophoneServerinstance
 global instance of the server
static const char *const MIC_LOCATOR
 aperios specific identifier for microphone access

Constructor & Destructor Documentation

virtual MicrophoneServer::~MicrophoneServer (  )  [virtual]

destructor

MicrophoneServer::MicrophoneServer (  )  [private]

constructor

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

don't call


Member Function Documentation

virtual void MicrophoneServer::doEvent (  )  [virtual]

Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.

Default implementation watches for 'private' text message events (those forwarded by a BehaviorSwitchControl from ControllerGUI input) and will publically rebroadcast them. The idea is that your own processEvent gets first dibs, but if the behavior doesn't handle the text message, it will be handed off for others.

Reimplemented from BehaviorBase.

virtual void MicrophoneServer::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 MicrophoneServer::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.

template<class T >
static void MicrophoneServer::encode ( char **  dst,
const T *  src,
int  num 
) [static, private]

writes length bytes from src to dst

Definition at line 65 of file MicrophoneServer.h.

template<class T >
static void MicrophoneServer::encode ( char **  dst,
const T &  value 
) [static, private]

writes value to dst and advances dst

Definition at line 58 of file MicrophoneServer.h.

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

enforces singleton status

unsigned int MicrophoneServer::GetResampledFrameSize ( unsigned int  samplesSize,
unsigned int  newSampleRate,
unsigned int  newSampleBits,
bool  newStereo 
) [private]

returns size of a "frame" at the given sampling rate and resolution

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

don't call

unsigned int MicrophoneServer::ResampleFrame ( const char *  samples,
unsigned int  samplesSize,
unsigned int &  newSampleRate,
unsigned int &  newSampleBits,
bool &  newStereo,
void *  newSamples,
unsigned int  newSamplesSize 
) [private]

performs sampling to a specified rate and resolution, stores into newSamples (which you must allocate)

static bool MicrophoneServer::SetMicrophoneAlcEnabled ( bool  enabled  )  [static]

makes Aperios-specific call to set microphone mode

static bool MicrophoneServer::SetMicrophoneUnidirectional ( bool  unidirectional  )  [static]

makes Aperios-specific call to set microphone mode


Member Data Documentation

global instance of the server

Definition at line 31 of file MicrophoneServer.h.

const char* const MicrophoneServer::MIC_LOCATOR [static, private]

aperios specific identifier for microphone access

Definition at line 51 of file MicrophoneServer.h.

const unsigned int MicrophoneServer::SEND_BUFFER_SIZE = 2048 + 16 [static, private]

max transmission buffer size for socket

Definition at line 26 of file MicrophoneServer.h.

class Socket* MicrophoneServer::socket [private]

socket for communication

Definition at line 54 of file MicrophoneServer.h.


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

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