Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

AiboSound Class Reference

#include <aibosound.h>

Collaboration diagram for AiboSound:

Collaboration graph
[legend]

Public Member Functions

 AiboSound ()
virtual ~AiboSound ()
Sound Playing
The followign methods are usefull for soundplayback with teh AIBO.

void OpenSpeaker ()
OPrimitiveID GetSpeakerID ()
bool IsAllRegionFree ()
void NewSoundVectorData ()
RCRegion * GetCommandVector (int index=0)
WAVError CopyWAVToRegion (RCRegion *region, int index)
WAVError CopyWAVToRegion (RCRegion *region, WAV wave)
WAVError CopyWAVToRegion (int regionIndex=0, int waveIndex=0)
RCRegion * FindFreeRegion () const
int FindFreeRegionIndex () const
RCRegion * GetRegion (int index)
void LoadWAV (char *sound)
void RewindWAV (int index)
void SetVolume (OSpeakerVolume vol)
void SetMute (bool mute)
void SetWaveType (int index=0)
void SetWaveType (WAVE_TYPE typ)
int GetValidRegions ()
int GetValidWaves ()
WAV GetWAV (int index)
void DeleteWaves ()
Sound recording
The following functions allow you to the set options for sound recording with the AIBO

void OpenMic (MIC_MODE mode=OMNI)
void NewSoundBuffer (int numSeconds)
void NewSoundBufferFrames (int numFrames)
void ResetSoundBuffer ()
void DeleteSoundBuffer ()
void CopyToSoundBuffer (OSoundVectorData *vec)
void SaveBuffer (char *file)
void SetMicMode (MIC_MODE mode)
void SetMicMode (OPrimitiveRequest req)
void SetMicALC (bool alc)
size_t GetBufferSize ()
size_t GetNumberOfFrames ()

Protected Attributes

OPrimitiveID SpeakerID
RCRegion * Region [MaxSoundRegions]
WAV Waves [MaxWaves]
ODesignDataID WavID [MaxWaves]
int ValidWaves
OPrimitiveID MicID
byte * SoundBuf
byte * SoundBufPtr
size_t SoundBufSize
size_t NumberOfFrames

Static Protected Attributes

static const int MaxSoundRegions = 2
static const int MaxWaves = 10
static const size_t SOUND_UNIT_SIZE_8 = 256
static const size_t SOUND_UNIT_SIZE_16 = 1024
static const size_t SOUND_REC_SIZE16 = 2048
static const size_t SOUND_REC_SIZE16_1SEC = 65536
static const size_t WAVE_HEADER_SIZE = 4 + 8 + 16 + 8
static const size_t FMTSIZE_WITHOUT_EXTINFO = 16

Detailed Description

Class for sound playing and recording on AIBO
Examples:

Makefile, MicExample.h, sound/Makefile, and SoundExample.h.


Constructor & Destructor Documentation

AiboSound::AiboSound  ) 
 

Default constructor

virtual AiboSound::~AiboSound  )  [inline, virtual]
 

Default destructor


Member Function Documentation

void AiboSound::OpenSpeaker  ) 
 

Opens the Speaker (sets OPrimitiveID SpeakerID)

OPrimitiveID AiboSound::GetSpeakerID  ) 
 

Returns the primitive id of the speaker

Returns:
OPrimitiveID of speaker

bool AiboSound::IsAllRegionFree  ) 
 

Methods looks if all sound regions in Region[] are free

Returns:
True if all regions are free, false otherwise

void AiboSound::NewSoundVectorData  ) 
 

Generates an new sound data vector an RCRegion

RCRegion * AiboSound::GetCommandVector int  index = 0  )  [inline]
 

Returns the CommandVectorData obtained by the region corresponding to the index

Parameters:
index Index of the RCRegion which is returned
Returns:
The RCRegion (which includes the command vector

WAVError AiboSound::CopyWAVToRegion RCRegion *  region,
int  index
 

Copys the wave file corresponding to index into the given RCRegion (makes it playable)

Parameters:
region RCRegion to wich the data of the wave file is copied
index Index of the wave file which should be loaded

Here is the call graph for this function:

WAVError AiboSound::CopyWAVToRegion RCRegion *  region,
WAV  wave
 

Copys the wave file into the given RCRegion (makes it playable)

Parameters:
region RCRegion to wich the data of the wave file is copied
wave WAV file which should be loaded

Here is the call graph for this function:

WAVError AiboSound::CopyWAVToRegion int  regionIndex = 0,
int  waveIndex = 0
 

Copy's the wave file corresponding to waveIndex into the given RCRegion corresponding to regionIndex (makes it playable)

Parameters:
regionIndex Index of the RCRegion to which the data of the wave file is copied
waveIndex Index of the wave file which should be loaded

Here is the call graph for this function:

RCRegion * AiboSound::FindFreeRegion  )  const
 

Locates an free region to which the wave data can be copied

Returns:
Free RCRegion

int AiboSound::FindFreeRegionIndex  )  const
 

Locates an free region to which the wave data can be copied

Returns:
Index of the free RCRegion

RCRegion * AiboSound::GetRegion int  index  )  [inline]
 

Returns the RCRegion with the index

Parameters:
index Index of the wanted region
Returns:
RCRegion corresponding to index

void AiboSound::LoadWAV char *  sound  ) 
 

Loads the wave file corresponding to entry in DESINGDB.CFG on memstick

Parameters:
sound Sound entry name in DESINGDB.CFG

Here is the call graph for this function:

void AiboSound::RewindWAV int  index  )  [inline]
 

Rewinds the wave file corresponding to index

Parameters:
index Index of the wave file in WaveFiles[] which will be rewinded

Here is the call graph for this function:

void AiboSound::SetVolume OSpeakerVolume  vol  ) 
 

Sets the speaker volume to a given level

Parameters:
vol Speaker volume

void AiboSound::SetMute bool  mute  ) 
 

Enables or disables muting for speaker

Parameters:
mute Mute on or off

void AiboSound::SetWaveType int  index = 0  ) 
 

Detects the Type of the loaded wave file

Parameters:
index Index of the command vector in which the wave file should be loaded

Here is the call graph for this function:

void AiboSound::SetWaveType WAVE_TYPE  typ  ) 
 

Sets the type of the loaded wave file

Parameters:
typ Type of wave file

int AiboSound::GetValidRegions  )  [inline]
 

Returns the number of valid sound regions

Deprecated:
because there are always MaxSoundRegions regions
Returns:
Number of valid sound regions

int AiboSound::GetValidWaves  )  [inline]
 

Returns var "ValidWaves"

Returns:
Number of valid wave files

WAV AiboSound::GetWAV int  index  )  [inline]
 

Returns the WAV file from var. "WaveFiles" corresponding to index

Parameters:
index Index of the wave file
Returns:
WAV

void AiboSound::DeleteWaves  ) 
 

Deletes the WavID's from array "WavID"

void AiboSound::OpenMic MIC_MODE  mode = OMNI  ) 
 

Opens the Mic (sets OPrimitiveID MicID)

Parameters:
mode Uni- or Omnidirectional. Default Omni

Here is the call graph for this function:

void AiboSound::NewSoundBuffer int  numSeconds  ) 
 

Creates an new Buffer for sound recording

Parameters:
numSeconds Number of seconds will be recorded

void AiboSound::NewSoundBufferFrames int  numFrames  ) 
 

Creates an new Buffer for sound recording

Parameters:
numFrames Number of frames (32ms) will be recorded

void AiboSound::ResetSoundBuffer  )  [inline]
 

Resets the sound buffer (empty's it for new recordings)

void AiboSound::DeleteSoundBuffer  ) 
 

Deletes the sound buffer

void AiboSound::CopyToSoundBuffer OSoundVectorData *  vec  ) 
 

Copys the sound data of one frame from the vector into the Buffer

Parameters:
vec Vector containing the sound data

void AiboSound::SaveBuffer char *  file  ) 
 

Saves the sound buffer as wave file on the memorystick

Parameters:
file File name for the sound

void AiboSound::SetMicMode MIC_MODE  mode  ) 
 

Sets the mode of the mic

Parameters:
mode Mic mode (UNI or OMNI)

void AiboSound::SetMicMode OPrimitiveRequest  req  ) 
 

Sets the mode of the mic

Parameters:
req Mic mode

void AiboSound::SetMicALC bool  alc  ) 
 

Enables or disables the automatic limit control (ALC for the mic)

Parameters:
alc ALC on or off

size_t AiboSound::GetBufferSize  )  [inline]
 

Returns the size of the sound buffer "SoundBuf"

Returns:
Size of the sound buffer

size_t AiboSound::GetNumberOfFrames  )  [inline]
 

Returns the number of frames, needed to fill the sound buffer

Returns:
Number of frames


Field Documentation

OPrimitiveID AiboSound::SpeakerID [protected]
 

The primitve ID of the speaker

const int AiboSound::MaxSoundRegions = 2 [static, protected]
 

Maximal allowed number of sound buffers

const int AiboSound::MaxWaves = 10 [static, protected]
 

Maximal allowed number of wave files

RCRegion* AiboSound::Region[MaxSoundRegions] [protected]
 

RCRegions which contain the SoundVectortData

WAV AiboSound::Waves[MaxWaves] [protected]
 

The wave files

ODesignDataID AiboSound::WavID[MaxWaves] [protected]
 

The ID of the wave files

int AiboSound::ValidWaves [protected]
 

Number of valid wave files for playing

const size_t AiboSound::SOUND_UNIT_SIZE_8 = 256 [static, protected]
 

bytes needed per one frame playback 8KHz 8bits MONO (8 * 1 * 1 * 32 = 256)

const size_t AiboSound::SOUND_UNIT_SIZE_16 = 1024 [static, protected]
 

bytes needed per one frame playback 16KHz 16bits MONO (16 * 2 * 1 * 32 = 256)

OPrimitiveID AiboSound::MicID [protected]
 

The primitive ID of the mic

byte* AiboSound::SoundBuf [protected]
 

The sound buffer

byte* AiboSound::SoundBufPtr [protected]
 

A pointer to the sound buffer

size_t AiboSound::SoundBufSize [protected]
 

The size of the sound buffer

size_t AiboSound::NumberOfFrames [protected]
 

Number of frames (32ms) needed to fill buffer

const size_t AiboSound::SOUND_REC_SIZE16 = 2048 [static, protected]
 

Size of 16kHz 16bit Stereo for one frame (32 ms) (16 * 2 * 2 * 32 = 2048)

const size_t AiboSound::SOUND_REC_SIZE16_1SEC = 65536 [static, protected]
 

Size of 16kHz 16bit Stereo for one second (1024ms) (16 * 2 * 2 * 32 * 32 = 65536)

const size_t AiboSound::WAVE_HEADER_SIZE = 4 + 8 + 16 + 8 [static, protected]
 

Constant introduced by SONY

const size_t AiboSound::FMTSIZE_WITHOUT_EXTINFO = 16 [static, protected]
 

Constant introduced by SONY


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

tams Tim Baier AiboLib v0.2.4
Generated Thu Jan 19 11:56:07 2006 by doxygen 1.4.3