Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArSoundPlayer Class Reference

This class provides a cross-platform interface for playing short sound samples. (Currently implemented for Windows and Linux). More...

#include <ArSoundPlayer.h>

List of all members.

Static Public Member Functions

static ArRetFunctor2< bool,
const char *, const char * > * 
getPlayWavFileCallback ()
static ArFunctorgetStopPlayingCallback ()
static bool playNativeFile (const char *filename, const char *params)
static bool playSoundPCM16 (char *data, int numSamples)
static bool playWavFile (const char *filename, const char *params)
static void stopPlaying ()

Static Protected Attributes

static int myPlayChildPID = -1
 Only used on Linux.
static ArGlobalRetFunctor2<
bool, const char *, const
char * > 
ourPlayWavFileCB
static ArGlobalFunctor ourStopPlayingCB


Detailed Description

This class provides a cross-platform interface for playing short sound samples. (Currently implemented for Windows and Linux).

See also:
For I/O and network transfer of encoded audio, see the ArNetAudio library.

ArSoundsQueue

Note:
Uses an external program to play WAV files on Linux. If an environment variable named PLAY_WAV is set, that program is used, otherwise, 'play' from the 'sox' toolset is used. Therefore, the playWavFile() will return immediately after 'play' has finished, even though Linux may still be playing back the sound data. In general, this kind of thing is a problem, especially with speech recognition immediately after playing a sound. Ideally, we should be able to truly block until the sound has finished playback.

Definition at line 41 of file ArSoundPlayer.h.


Member Function Documentation

ArRetFunctor2< bool, const char *, const char * > * ArSoundPlayer::getPlayWavFileCallback  )  [static]
 

Return the static functor for playWavFile

Definition at line 36 of file ArSoundPlayer.cpp.

Referenced by ArSoundsQueue::ArSoundsQueue().

ArFunctor * ArSoundPlayer::getStopPlayingCallback  )  [static]
 

Return the static functor for stopPlaying().

Definition at line 41 of file ArSoundPlayer.cpp.

Referenced by ArSoundsQueue::ArSoundsQueue().

bool ArSoundPlayer::playNativeFile const char *  filename,
const char *  params
[static]
 

Play a file in some native file format for the compilation platform.

Definition at line 95 of file ArSoundPlayer.cpp.

bool ArSoundPlayer::playSoundPCM16 char *  data,
int  numSamples
[static]
 

Play raw uncompressed PCM16 sound data. The format of this data is numSamples samples of two bytes each. Each byte pair is a signed little endian integer. The sound will be played back at 16kHz, monaurally.

Returns:
false on error, true on success.

Definition at line 171 of file ArSoundPlayer.cpp.

References ArLog::log().

bool ArSoundPlayer::playWavFile const char *  filename,
const char *  params
[static]
 

Play a WAV (Windows RIFF) file

Note:
Uses an external program to play WAV files on Linux. If an environment variable named PLAY_WAV is set, that program is used, otherwise, 'play' from the 'sox' toolset is used.
Parameters:
filename Name of the file to play
params ignored

Definition at line 121 of file ArSoundPlayer.cpp.

References ArLog::log(), and myPlayChildPID.

void ArSoundPlayer::stopPlaying  )  [static]
 

Cancel (interrupt) any current sound or file playback.

Definition at line 160 of file ArSoundPlayer.cpp.

References ArLog::log(), and myPlayChildPID.


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:55 2005 for Aria by  doxygen 1.4.0