This is the abstract base class for an audio device. More...
#include <AudioDevice.hxx>
Classes | |
struct | TInfo |
This class is used to respond to device information request using the GetInfo method. More... | |
Public Member Functions | |
AudioDevice (const std::string &name) | |
Constructor of the class that sets the name of object to the string passed by parameter. | |
virtual | ~AudioDevice () |
Destructor of class. | |
virtual void | Start (void)=0 throw (Err) |
This method must be called to begin the use of this Device. | |
virtual void | Stop (void)=0 throw (Err) |
This method must be called to end the use of this Device. | |
virtual void | Read (Audio &audio, const int channelID)=0 |
Reads the information given by this Device and passes data to an Audio chunk. | |
virtual void | Write (const Audio &audio, const int channelID)=0 |
Writes the information given by an Audio chunk in the Devices. | |
virtual void | GetInfo (TInfo &) |
Getter for the Info of Device Object attached to this AudioDevices instantiation. | |
virtual void | SetNChannels (int channels) |
Setter for the number of channels to allocate in the hardware. | |
Public Attributes | |
std::vector< AudioIn * > | mInputs |
std::vector< AudioOut * > | mOutputs |
std::string | mName |
bool | mForceNChannels |
int | mNChannels |
int | mNReadChannels |
int | mNWriteChannels |
Protected Member Functions | |
bool | Register (AudioManager *am, AudioIn &in) |
bool | Register (AudioManager *am, AudioOut &out) |
void | Unregister (AudioIn &in) |
void | Unregister (AudioOut &out) |
int | SampleRate (void) |
int | Latency (void) |
void | SetLatency (int latency) |
Friends | |
class | AudioIn |
class | AudioOut |
class | AudioManager |
This is the abstract base class for an audio device.
With an audio device we refer to any kind of (multichannel) audio input/output/fullduplex. AudioDevices are usually created by the AudioManager. The interface for the user however, are the AudioIn and AudioOut classes.
Each AudioIn and AudioOut created is registered with the AudioManager. When the AudioManager is started, it will create the appropiate AudioDevice or AudioDevices, based on the number of inputs, outputs, operating system and AudioIOConfig of the AudioIn and AudioOut objects.
Definition at line 39 of file AudioDevice.hxx.
CLAM::AudioDevice::AudioDevice | ( | const std::string & | name | ) | [inline] |
Constructor of the class that sets the name of object to the string passed by parameter.
Definition at line 87 of file AudioDevice.hxx.
References mForceNChannels, mName, mNChannels, mNReadChannels, and mNWriteChannels.
virtual CLAM::AudioDevice::~AudioDevice | ( | ) | [inline, virtual] |
Destructor of class.
Definition at line 96 of file AudioDevice.hxx.
void AudioDevice::GetInfo | ( | AudioDevice::TInfo & | info | ) | [virtual] |
Getter for the Info of Device Object attached to this AudioDevices instantiation.
info | TInfo object that method will modify with the values of Tinfo internal object |
Definition at line 111 of file AudioDevice.cxx.
References mName, CLAM::AudioDevice::TInfo::mName, mNChannels, CLAM::AudioDevice::TInfo::mNChannels, mNReadChannels, CLAM::AudioDevice::TInfo::mNReadChannels, mNWriteChannels, CLAM::AudioDevice::TInfo::mNWriteChannels, CLAM::AudioDevice::TInfo::mSampleRate, and SampleRate().
int AudioDevice::Latency | ( | void | ) | [protected] |
Definition at line 161 of file AudioDevice.cxx.
References CLAM::AudioManager::Latency().
Reads the information given by this Device and passes data to an Audio chunk.
Must be implemented by any Device derived from this class.
audio | Audio object where data will be stored. | |
channelID | Channel to read. |
Implemented in CLAM::RtAAudioDevice.
Referenced by CLAM::AudioIn::Do().
bool AudioDevice::Register | ( | AudioManager * | am, | |
AudioOut & | out | |||
) | [protected] |
Definition at line 65 of file AudioDevice.cxx.
References CLAM::AudioOut::GetConfig(), and mOutputs.
bool AudioDevice::Register | ( | AudioManager * | am, | |
AudioIn & | in | |||
) | [protected] |
Definition at line 49 of file AudioDevice.cxx.
References CLAM::AudioIn::GetConfig(), and mInputs.
Referenced by CLAM::AudioManager::Register().
int AudioDevice::SampleRate | ( | void | ) | [protected] |
Definition at line 120 of file AudioDevice.cxx.
References mInputs, mOutputs, and CLAM::AudioManager::SampleRate().
Referenced by GetInfo().
void AudioDevice::SetLatency | ( | int | latency | ) | [protected] |
Definition at line 166 of file AudioDevice.cxx.
References CLAM::AudioManager::SetLatency().
void AudioDevice::SetNChannels | ( | int | channels | ) | [virtual] |
Setter for the number of channels to allocate in the hardware.
This is necessary for certain hardware which needs a fixed number of channels (ADAT or SPDIF).
Number | of channels |
Definition at line 171 of file AudioDevice.cxx.
References mForceNChannels, and mNChannels.
virtual void CLAM::AudioDevice::Start | ( | void | ) | throw (Err) [pure virtual] |
This method must be called to begin the use of this Device.
Must be implemented by any Device derived from this class
Implemented in CLAM::RtAAudioDevice.
virtual void CLAM::AudioDevice::Stop | ( | void | ) | throw (Err) [pure virtual] |
This method must be called to end the use of this Device.
Must be implemented by any Device derived from this class
Implemented in CLAM::RtAAudioDevice.
Referenced by CLAM::AudioOut::GetDeviceInfo().
void AudioDevice::Unregister | ( | AudioOut & | out | ) | [protected] |
Definition at line 96 of file AudioDevice.cxx.
References mOutputs.
void AudioDevice::Unregister | ( | AudioIn & | in | ) | [protected] |
Definition at line 81 of file AudioDevice.cxx.
References mInputs.
Referenced by CLAM::AudioIn::~AudioIn().
Writes the information given by an Audio chunk in the Devices.
Must be implemented by any Device derived from this class.
audio | Audio object with values that must to be passed to Devices | |
channelID | Channel to write |
Implemented in CLAM::RtAAudioDevice.
Referenced by CLAM::AudioOut::Do().
friend class AudioIn [friend] |
Definition at line 41 of file AudioDevice.hxx.
friend class AudioManager [friend] |
Definition at line 43 of file AudioDevice.hxx.
friend class AudioOut [friend] |
Definition at line 42 of file AudioDevice.hxx.
Definition at line 79 of file AudioDevice.hxx.
Referenced by AudioDevice(), and SetNChannels().
std::vector<AudioIn*> CLAM::AudioDevice::mInputs |
Definition at line 75 of file AudioDevice.hxx.
Referenced by Register(), SampleRate(), and Unregister().
std::string CLAM::AudioDevice::mName |
Definition at line 78 of file AudioDevice.hxx.
Referenced by AudioDevice(), and GetInfo().
Definition at line 80 of file AudioDevice.hxx.
Referenced by AudioDevice(), GetInfo(), and SetNChannels().
Definition at line 81 of file AudioDevice.hxx.
Referenced by AudioDevice(), and GetInfo().
Definition at line 82 of file AudioDevice.hxx.
Referenced by AudioDevice(), and GetInfo().
std::vector<AudioOut*> CLAM::AudioDevice::mOutputs |
Definition at line 76 of file AudioDevice.hxx.
Referenced by Register(), SampleRate(), and Unregister().