CLAM::AudioManager Class Reference

This class takes care of all the creation of the registration of AudioIn and AudioOut objects, and the creation of AudioDevice objects required. More...

#include <AudioManager.hxx>

List of all members.

Public Types

typedef std::vector
< AudioDevice * >
::const_iterator 
device_iterator
typedef std::vector
< AudioDeviceList * >
::const_iterator 
list_iterator

Public Member Functions

 AudioManager (int sampleRate, int latency)
 Constructor of the class.
 ~AudioManager ()
 Destructor of the class.
AudioDeviceFindDevice (const std::string &name)
 Find a created AudioDevice, or NULL when not found.
AudioDeviceFindOrCreateDevice (const std::string &name)
 Find a created AudioDevice, or create it when not found.
void Start (void) throw (Err)
 This method starts the AudioManager object.
int SampleRate (void)
 Getter to obtain the sample rate of the AudioManager.
int Latency (void)
 Getter to obtain the latency of the AudioManager.
void SetLatency (int latency)
 Setter to change the latency of the AudioManager.
AudioDeviceListFindList (const std::string &arch="default")
 Retrieve the list of devices available for a given architecture.
list_iterator lists_begin () const
 Global iterator interface for device lists.
list_iterator lists_end () const
 Global iterator interface for device lists.
device_iterator used_devices_begin () const
 Iterator interface for used audio devices.
device_iterator used_devices_end () const
 Iterator interface for used audio devices.

Static Public Member Functions

static AudioManagerCurrent ()

Protected Member Functions

bool Register (AudioIn &in)
 Register an AudioIn object.
bool Register (AudioOut &out)
 Register an AudioOut object.

Friends

class AudioIn
class AudioOut
class AudioDeviceList

Detailed Description

This class takes care of all the creation of the registration of AudioIn and AudioOut objects, and the creation of AudioDevice objects required.

It's a singleton class (only must be an instantiation of this class) because and unique object manages all the Devices, AudioOut and AudioIn objects provided by the system

See also:
AudioIn, AudioOut, AudioDevice

Definition at line 41 of file AudioManager.hxx.


Member Typedef Documentation

typedef std::vector<AudioDevice*>::const_iterator CLAM::AudioManager::device_iterator

Definition at line 69 of file AudioManager.hxx.

typedef std::vector<AudioDeviceList*>::const_iterator CLAM::AudioManager::list_iterator

Definition at line 70 of file AudioManager.hxx.


Constructor & Destructor Documentation

CLAM::AudioManager::AudioManager ( int  sampleRate,
int  latency 
)

Constructor of the class.

It receives as parameter the sample rate and latency

Parameters:
sampleRate The sample rate that will be given to the AudioManager, and passed to the AudioDevice(s). The default is 48000.
latency The latency that will be given to the AudioManager, and passed to the AudioDevice(s). The default is 512.

Definition at line 31 of file AudioManager.cxx.

CLAM::AudioManager::~AudioManager (  ) 

Destructor of the class.

Definition at line 39 of file AudioManager.cxx.


Member Function Documentation

static AudioManager& CLAM::AudioManager::Current (  )  [inline, static]

Definition at line 84 of file AudioManager.hxx.

AudioDevice * CLAM::AudioManager::FindDevice ( const std::string &  name  ) 

Find a created AudioDevice, or NULL when not found.

Parameters:
name The name of the AudioDevice we want to get
Returns:
the AudioDevice if it exists, or NULL otherwise

Definition at line 55 of file AudioManager.cxx.

Referenced by FindOrCreateDevice().

AudioDeviceList * CLAM::AudioManager::FindList ( const std::string &  arch = "default"  ) 

Retrieve the list of devices available for a given architecture.

You can then use the AvailableDevices() method to retrieve a list of the available devices for each AudioDeviceList.

Parameters:
arch The name of architecture wich will be returned the devices. By default is set to "default"
Returns:
The list of AudioDevices

Definition at line 169 of file AudioManager.cxx.

References DEFAULT_AUDIO_ARCH.

Referenced by FindOrCreateDevice().

AudioDevice * CLAM::AudioManager::FindOrCreateDevice ( const std::string &  name  ) 

Find a created AudioDevice, or create it when not found.

Parameters:
name The name of the AudioDevice we want to get
Returns:
the AudioDevice if it exists; otherwise method will create and return a new AudioDevice

Definition at line 80 of file AudioManager.cxx.

References CLAM::AudioDeviceList::AvailableDevices(), CLAM::AudioDeviceList::Create(), DEFAULT_AUDIO_ARCH, CLAM::AudioDeviceList::DefaultDevice(), FindDevice(), and FindList().

Referenced by Register().

int CLAM::AudioManager::Latency ( void   )  [inline]

Getter to obtain the latency of the AudioManager.

Returns:
the latency

Definition at line 116 of file AudioManager.hxx.

Referenced by CLAM::AudioDevice::Latency().

list_iterator CLAM::AudioManager::lists_begin (  )  const [inline]

Global iterator interface for device lists.

It can be used to obtain the device list for each existent architecture.

Returns:
The beginning list iterator

Definition at line 133 of file AudioManager.hxx.

list_iterator CLAM::AudioManager::lists_end (  )  const [inline]

Global iterator interface for device lists.

It can be used to obtain the device list for each existent architecture.

Returns:
The ending list iterator

Definition at line 139 of file AudioManager.hxx.

bool CLAM::AudioManager::Register ( AudioOut out  )  [protected]

Register an AudioOut object.

This is done by the AudioOut object itself

Definition at line 163 of file AudioManager.cxx.

References FindOrCreateDevice(), and CLAM::AudioDevice::Register().

bool CLAM::AudioManager::Register ( AudioIn in  )  [protected]

Register an AudioIn object.

This is done by the AudioIn object itself

Definition at line 157 of file AudioManager.cxx.

References FindOrCreateDevice(), and CLAM::AudioDevice::Register().

int CLAM::AudioManager::SampleRate ( void   )  [inline]

Getter to obtain the sample rate of the AudioManager.

Returns:
the sample rate

Definition at line 111 of file AudioManager.hxx.

Referenced by CLAM::AudioDevice::SampleRate().

void CLAM::AudioManager::SetLatency ( int  latency  )  [inline]

Setter to change the latency of the AudioManager.

Definition at line 120 of file AudioManager.hxx.

Referenced by CLAM::AudioDevice::SetLatency().

void CLAM::AudioManager::Start ( void   )  throw (Err)

This method starts the AudioManager object.

Definition at line 70 of file AudioManager.cxx.

device_iterator CLAM::AudioManager::used_devices_begin (  )  const [inline]

Iterator interface for used audio devices.

It will iterate through the list of devices which have been registered.

Returns:
The beginning list iterator

Definition at line 144 of file AudioManager.hxx.

device_iterator CLAM::AudioManager::used_devices_end (  )  const [inline]

Iterator interface for used audio devices.

It will iterate through the list of devices which have been registered.

Returns:
The ending list iterator

Definition at line 148 of file AudioManager.hxx.


Friends And Related Function Documentation

friend class AudioDeviceList [friend]

Definition at line 45 of file AudioManager.hxx.

friend class AudioIn [friend]

Definition at line 43 of file AudioManager.hxx.

friend class AudioOut [friend]

Definition at line 44 of file AudioManager.hxx.


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3