#include <AudioDevice.hxx>
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.
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 |
Classes | |
struct | TInfo |
This class is used to respond to device information request using the GetInfo method. More... |
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] |
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, and CLAM::RtAAudioDevice.
Referenced by CLAM::AudioOut::ConcreteStart(), and CLAM::AudioIn::ConcreteStart().
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, and CLAM::RtAAudioDevice.
Referenced by CLAM::AudioOut::ConcreteStop().
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, and CLAM::RtAAudioDevice.
Referenced by CLAM::AudioIn::Do().
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, and CLAM::RtAAudioDevice.
Referenced by CLAM::AudioOut::Do().
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 |
Reimplemented in CLAM::RtAAudioDevice.
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().
Referenced by CLAM::AudioOut::GetDeviceInfo(), CLAM::AudioIn::GetDeviceInfo(), and CLAM::RtAAudioDevice::GetInfo().
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.
bool AudioDevice::Register | ( | AudioManager * | am, | |
AudioIn & | in | |||
) | [protected] |
Definition at line 49 of file AudioDevice.cxx.
References CLAM::AudioIn::GetConfig(), mInputs, and CLAM::AudioIn::mpDevice.
Referenced by CLAM::AudioManager::Register().
bool AudioDevice::Register | ( | AudioManager * | am, | |
AudioOut & | out | |||
) | [protected] |
Definition at line 65 of file AudioDevice.cxx.
References CLAM::AudioOut::GetConfig(), mOutputs, and CLAM::AudioOut::mpDevice.
void AudioDevice::Unregister | ( | AudioIn & | in | ) | [protected] |
Definition at line 81 of file AudioDevice.cxx.
References mInputs, and CLAM::AudioIn::mpDevice.
Referenced by CLAM::AudioOut::ConcreteConfigure(), CLAM::AudioIn::ConcreteConfigure(), CLAM::AudioIn::~AudioIn(), and CLAM::AudioOut::~AudioOut().
void AudioDevice::Unregister | ( | AudioOut & | out | ) | [protected] |
int AudioDevice::SampleRate | ( | void | ) | [protected] |
Definition at line 120 of file AudioDevice.cxx.
References mInputs, mOutputs, and CLAM::AudioManager::SampleRate().
Referenced by GetInfo(), and CLAM::RtAAudioDevice::Start().
int AudioDevice::Latency | ( | void | ) | [protected] |
Definition at line 161 of file AudioDevice.cxx.
References CLAM::AudioManager::Latency().
Referenced by CLAM::RtAAudioDevice::Start().
void AudioDevice::SetLatency | ( | int | latency | ) | [protected] |
Definition at line 166 of file AudioDevice.cxx.
References CLAM::AudioManager::SetLatency().
Referenced by CLAM::RtAAudioDevice::Start().
friend class AudioIn [friend] |
Definition at line 41 of file AudioDevice.hxx.
friend class AudioOut [friend] |
Definition at line 42 of file AudioDevice.hxx.
friend class AudioManager [friend] |
Definition at line 43 of file AudioDevice.hxx.
std::vector<AudioIn*> CLAM::AudioDevice::mInputs |
Definition at line 75 of file AudioDevice.hxx.
Referenced by Register(), SampleRate(), CLAM::RtAAudioDevice::Start(), and Unregister().
std::vector<AudioOut*> CLAM::AudioDevice::mOutputs |
Definition at line 76 of file AudioDevice.hxx.
Referenced by Register(), SampleRate(), CLAM::RtAAudioDevice::Start(), and Unregister().
std::string CLAM::AudioDevice::mName |
Definition at line 80 of file AudioDevice.hxx.
Referenced by AudioDevice(), GetInfo(), and SetNChannels().