CLAM-Development  1.4.0
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Friends
CLAM::AudioDevice Class Reference

This is the abstract base class for an audio device. More...

#include <AudioDevice.hxx>

List of all members.

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

Detailed Description

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.

See also:
AudioIn, AudioOut, AudioDeviceList, AudioManager

Definition at line 39 of file AudioDevice.hxx.


Constructor & Destructor Documentation

CLAM::AudioDevice::AudioDevice ( const std::string &  name)
inline

Constructor of the class that sets the name of object to the string passed by parameter.

  • name String with the name of object

Definition at line 87 of file AudioDevice.hxx.

References mForceNChannels, mName, mNChannels, mNReadChannels, and mNWriteChannels.

virtual CLAM::AudioDevice::~AudioDevice ( )
inlinevirtual

Destructor of class.

Definition at line 96 of file AudioDevice.hxx.


Member Function Documentation

void AudioDevice::GetInfo ( AudioDevice::TInfo info)
virtual

Getter for the Info of Device Object attached to this AudioDevices instantiation.

Parameters:
infoTInfo object that method will modify with the values of Tinfo internal object

Definition at line 111 of file AudioDevice.cxx.

References CLAM::AudioDevice::TInfo::mName, mName, CLAM::AudioDevice::TInfo::mNChannels, mNChannels, CLAM::AudioDevice::TInfo::mNReadChannels, mNReadChannels, CLAM::AudioDevice::TInfo::mNWriteChannels, mNWriteChannels, CLAM::AudioDevice::TInfo::mSampleRate, and SampleRate().

Referenced by CLAM::AudioIn::GetDeviceInfo(), and CLAM::AudioOut::GetDeviceInfo().

int AudioDevice::Latency ( void  )
protected

Definition at line 161 of file AudioDevice.cxx.

References CLAM::AudioManager::Latency().

Referenced by CLAM::RtAAudioDevice::Start().

virtual void CLAM::AudioDevice::Read ( Audio audio,
const int  channelID 
)
pure virtual

Reads the information given by this Device and passes data to an Audio chunk.

Must be implemented by any Device derived from this class.

Parameters:
audioAudio object where data will be stored.
channelIDChannel to read.

Implemented in CLAM::RtAAudioDevice.

Referenced by CLAM::AudioIn::Do().

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().

bool AudioDevice::Register ( AudioManager am,
AudioOut out 
)
protected

Definition at line 65 of file AudioDevice.cxx.

References CLAM::AudioOut::GetConfig(), and mOutputs.

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().

void AudioDevice::SetLatency ( int  latency)
protected

Definition at line 166 of file AudioDevice.cxx.

References CLAM::AudioManager::SetLatency().

Referenced by CLAM::RtAAudioDevice::Start().

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).

Parameters:
Numberof 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.

Referenced by CLAM::AudioIn::ConcreteStart(), and CLAM::AudioOut::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.

Referenced by CLAM::AudioOut::ConcreteStop().

void AudioDevice::Unregister ( AudioIn in)
protected
void AudioDevice::Unregister ( AudioOut out)
protected

Definition at line 96 of file AudioDevice.cxx.

References mOutputs.

virtual void CLAM::AudioDevice::Write ( const Audio audio,
const int  channelID 
)
pure virtual

Writes the information given by an Audio chunk in the Devices.

Must be implemented by any Device derived from this class.

Parameters:
audioAudio object with values that must to be passed to Devices
channelIDChannel to write

Implemented in CLAM::RtAAudioDevice.

Referenced by CLAM::AudioOut::Do().


Friends And Related Function Documentation

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.


Member Data Documentation

bool CLAM::AudioDevice::mForceNChannels

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(), CLAM::RtAAudioDevice::Start(), and Unregister().

std::string CLAM::AudioDevice::mName

Definition at line 78 of file AudioDevice.hxx.

Referenced by AudioDevice(), and GetInfo().

int CLAM::AudioDevice::mNChannels

Definition at line 80 of file AudioDevice.hxx.

Referenced by AudioDevice(), GetInfo(), and SetNChannels().

int CLAM::AudioDevice::mNReadChannels

Definition at line 81 of file AudioDevice.hxx.

Referenced by AudioDevice(), and GetInfo().

int CLAM::AudioDevice::mNWriteChannels

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(), CLAM::RtAAudioDevice::Start(), and Unregister().


The documentation for this class was generated from the following files: