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

DeviceAudio Class Reference

abstract base class for stereo audio mixer/playback devices More...

#include <proAudio.h>

Inheritance diagram for DeviceAudio:

DeviceAudioRt DeviceAudioSdl List of all members.

Public Member Functions

void volume (float left, float right)
void volume (float leftAndRight)
bool loaderRegister (AudioSample *(*loadFunc)(const std::string &), const std::string &suffix)
bool loaderAvailable (const std::string &suffix) const
virtual unsigned int sampleFromFile (const std::string &filename, float volume=1.0f)
virtual unsigned int sampleFromMemory (const AudioSample &sample, float volume=1.0f)=0
virtual bool sampleDestroy (unsigned int sample)=0
virtual const AudioSamplesample (unsigned int handle) const
virtual unsigned int soundPlay (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0
virtual unsigned int soundLoop (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0
virtual bool soundUpdate (unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)=0
virtual bool soundStop (unsigned int sound)=0
virtual void soundStop ()=0
virtual unsigned int soundActive () const =0

Static Public Member Functions

static DeviceAudiosingleton ()
static void destroy ()

Protected Member Functions

 DeviceAudio ()
virtual ~DeviceAudio ()

Protected Attributes

unsigned int m_freqOut
float m_volL
float m_volR
std::map< std::string, AudioSample
*(*)(const std::string &)> 
mm_loader

Static Protected Attributes

static DeviceAudios_instance

Detailed Description

abstract base class for stereo audio mixer/playback devices


Constructor & Destructor Documentation

DeviceAudio::DeviceAudio  )  [protected]
 

constructor

virtual DeviceAudio::~DeviceAudio  )  [inline, protected, virtual]
 

destructor


Member Function Documentation

static void DeviceAudio::destroy  )  [inline, static]
 

calls the destructor of the singleton object

bool DeviceAudio::loaderAvailable const std::string &  suffix  )  const
 

returns true in case a loader for this file type is available

bool DeviceAudio::loaderRegister AudioSample *(*)(const std::string &)  loadFunc,
const std::string &  suffix
 

registers an audio sample loader function handling a file type identified by suffix

The function has to be of type AudioSample * loadXYZ(const std::string & filename).

virtual const AudioSample* DeviceAudio::sample unsigned int  handle  )  const [inline, virtual]
 

allows read access to a sample identified by its handle

Reimplemented in DeviceAudioRt.

virtual bool DeviceAudio::sampleDestroy unsigned int  sample  )  [pure virtual]
 

deletes a previously created sound sample resource identified by its handle

Implemented in DeviceAudioRt, and DeviceAudioSdl.

virtual unsigned int DeviceAudio::sampleFromFile const std::string &  filename,
float  volume = 1.0f
[virtual]
 

loads a sound sample from file, optionally adjusts volume, returns handle

virtual unsigned int DeviceAudio::sampleFromMemory const AudioSample sample,
float  volume = 1.0f
[pure virtual]
 

converts a sound sample to internal audio format, returns handle

Implemented in DeviceAudioRt, and DeviceAudioSdl.

static DeviceAudio& DeviceAudio::singleton  )  [inline, static]
 

returns singleton object

This call is only allowed after a successful precedent creation of an audio device

virtual unsigned int DeviceAudio::soundActive  )  const [pure virtual]
 

returns number of currently active sounds

Implemented in DeviceAudioRt, and DeviceAudioSdl.

virtual unsigned int DeviceAudio::soundLoop unsigned int  sample,
float  volumeL = 1.0f,
float  volumeR = 1.0f,
float  disparity = 0.0f,
float  pitch = 1.0f
[pure virtual]
 

plays a specified sound sample continuously and sets its parameters

Parameters:
sample handle of a previously loaded sample
volumeL (optional) left volume
volumeR (optional) right volume
disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
Returns:
a handle to the currently played sound or -1 in case of error

Implemented in DeviceAudioRt, and DeviceAudioSdl.

virtual unsigned int DeviceAudio::soundPlay unsigned int  sample,
float  volumeL = 1.0f,
float  volumeR = 1.0f,
float  disparity = 0.0f,
float  pitch = 1.0f
[pure virtual]
 

plays a specified sound sample once and sets its parameters

Parameters:
sample handle of a previously loaded sample
volumeL (optional) left volume
volumeR (optional) right volume
disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
Returns:
a handle to the currently played sound or -1 in case of error

Implemented in DeviceAudioRt, and DeviceAudioSdl.

virtual void DeviceAudio::soundStop  )  [pure virtual]
 

stops all sounds immediately

Implemented in DeviceAudioRt, and DeviceAudioSdl.

virtual bool DeviceAudio::soundStop unsigned int  sound  )  [pure virtual]
 

stops a specified sound immediately

Implemented in DeviceAudioRt, and DeviceAudioSdl.

virtual bool DeviceAudio::soundUpdate unsigned int  sound,
float  volumeL,
float  volumeR,
float  disparity = 0.0f,
float  pitch = 1.0f
[pure virtual]
 

updates parameters of a specified sound

Parameters:
sound handle of a currently active sound
volumeL left volume
volumeR right volume
disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
Returns:
true in case the parameters have been updated successfully

Implemented in DeviceAudioRt, and DeviceAudioSdl.

void DeviceAudio::volume float  leftAndRight  )  [inline]
 

sets master volume

void DeviceAudio::volume float  left,
float  right
[inline]
 

sets master volume


Member Data Documentation

unsigned int DeviceAudio::m_freqOut [protected]
 

stores output stream frequency

float DeviceAudio::m_volL [protected]
 

stores left master volume

float DeviceAudio::m_volR [protected]
 

stores right master volume

std::map<std::string, AudioSample * (*)(const std::string &)> DeviceAudio::mm_loader [protected]
 

map associating suffixes to loader functions

DeviceAudio* DeviceAudio::s_instance [static, protected]
 

pointer to singleton


The documentation for this class was generated from the following file:
© 2009-02-04 by Gerald Franz, www.viremo.de impressum