Gizmod::Alsa Class Reference

OO Interface to ALSA. More...

#include <Alsa.hpp>

Inheritance diagram for Gizmod::Alsa:

Inheritance graph
[legend]
Collaboration diagram for Gizmod::Alsa:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void init ()
 Initialize Alsa.
AlsaMixer const * getDefaultMixerSwitch ()
 Get the system's default mixer for muting.
AlsaMixer const * getDefaultMixerVolume ()
 Get the system's default mixer for volume.
size_t getNumSoundCards ()
 Get the number of sound cards attached.
AlsaSoundCard const * getSoundCard (int Index)
 Get a sound card by index.
void toggleMuteAllCards ()
 Toggle mute on all sound cards.
virtual void onAlsaEventMixerElementAttach (AlsaEvent const &Event, AlsaSoundCard const &SoundCard, AlsaMixer const &Mixer)
 Triggered when a mixer element is discovered.
virtual void onAlsaEventMixerElementChange (AlsaEvent const &Event, AlsaSoundCard const &SoundCard, AlsaMixer const &Mixer)
 Triggered when a mixer element is discovered.
virtual void onAlsaEventMixerElementDetach (AlsaEvent const &Event, AlsaSoundCard const &SoundCard, AlsaMixer const &Mixer)
 Triggered when a mixer element is detached.
virtual void onAlsaEventSoundCardAttach (AlsaEvent const &Event, AlsaSoundCard const &SoundCard)
 Triggered when a new sound card is detected.
virtual void onAlsaEventSoundCardDetach (AlsaEvent const &Event, AlsaSoundCard const &SoundCard)
 Triggered when a sound card is removed.
void registerDefaultMixerPriority (std::string MixerName)
 Register a default mixer priority.
void shutdown ()
 Shutdown the Alsa connection.
 Alsa ()
 Alsa Default Constructor.
virtual ~Alsa ()
 Alsa Destructor.

Friends

class AlsaMixer


Detailed Description

OO Interface to ALSA.

Note this creates 1 thread per sound card, and watches for mixer events on all sound cards and all sound card elements when initted

Definition at line 72 of file Alsa.hpp.


Member Function Documentation

void Alsa::init (  ) 

Initialize Alsa.

Initialize ALSA.

Definition at line 109 of file Alsa.cpp.

References cdbg1, H::Exception::getExceptionMessage(), and shutdown().

AlsaMixer const * Alsa::getDefaultMixerSwitch (  ) 

Get the system's default mixer for muting.

Returns:
The desired AlsaMixer

Definition at line 77 of file Alsa.cpp.

AlsaMixer const * Alsa::getDefaultMixerVolume (  ) 

Get the system's default mixer for volume.

Returns:
The desired AlsaMixer

Definition at line 85 of file Alsa.cpp.

size_t Alsa::getNumSoundCards (  ) 

Get the number of sound cards attached.

Returns:
The number of sound cards

Definition at line 93 of file Alsa.cpp.

void Alsa::toggleMuteAllCards (  ) 

Toggle mute on all sound cards.

Toggle muting on all cards / mixers.

Shhh...

Definition at line 262 of file Alsa.cpp.

void Alsa::onAlsaEventMixerElementAttach ( AlsaEvent const &  Event,
AlsaSoundCard const &  SoundCard,
AlsaMixer const &  Mixer 
) [virtual]

Triggered when a mixer element is discovered.

Parameters:
Event The event
SoundCard The sound card that triggered the event
Mixer The mixer element that triggered the event

Definition at line 139 of file Alsa.cpp.

References cdbg1, Gizmod::AlsaSoundCard::getCardName(), and Gizmod::AlsaMixer::getName().

void Alsa::onAlsaEventMixerElementChange ( AlsaEvent const &  Event,
AlsaSoundCard const &  SoundCard,
AlsaMixer const &  Mixer 
) [virtual]

Triggered when a mixer element is discovered.

Triggered when a mixer element is changed.

Parameters:
Event The event
SoundCard The sound card that triggered the event
Mixer The mixer element that triggered the event

Definition at line 150 of file Alsa.cpp.

References Gizmod::ALSAEVENT_MIXERELEMENT_CHANGE, cdbg2, Gizmod::AlsaEvent::ElementsChanged, Gizmod::AlsaSoundCard::getCardName(), Gizmod::AlsaMixer::getName(), Gizmod::AlsaEvent::IsActiveChanged, Gizmod::AlsaEvent::Mask, Gizmod::AlsaEvent::Type, Gizmod::AlsaEvent::VolumePlaybackChanged, and Gizmod::AlsaMixerElements::VolumePlaybackPercent.

void Alsa::onAlsaEventMixerElementDetach ( AlsaEvent const &  Event,
AlsaSoundCard const &  SoundCard,
AlsaMixer const &  Mixer 
) [virtual]

Triggered when a mixer element is detached.

Parameters:
Event The event
SoundCard The sound card that triggered the event
Mixer The mixer element that triggered the event

Definition at line 205 of file Alsa.cpp.

References cdbg3, Gizmod::AlsaSoundCard::getCardName(), and Gizmod::AlsaMixer::getName().

void Alsa::onAlsaEventSoundCardAttach ( AlsaEvent const &  Event,
AlsaSoundCard const &  SoundCard 
) [virtual]

Triggered when a new sound card is detected.

Parameters:
Event The event
SoundCard The sound card that triggered the event

Definition at line 215 of file Alsa.cpp.

References cdbg, Gizmod::AlsaSoundCard::getCardHardwareID(), and Gizmod::AlsaSoundCard::getCardName().

void Alsa::onAlsaEventSoundCardDetach ( AlsaEvent const &  Event,
AlsaSoundCard const &  SoundCard 
) [virtual]

Triggered when a sound card is removed.

Parameters:
Event The event
SoundCard The sound card that triggered the event

Definition at line 225 of file Alsa.cpp.

References cdbg1, Gizmod::AlsaSoundCard::getCardHardwareID(), and Gizmod::AlsaSoundCard::getCardName().

void Alsa::registerDefaultMixerPriority ( std::string  MixerName  ) 

Register a default mixer priority.

Parameters:
MixerName Name of the mixer to add
Ie, If the default mixer list contains ["master", "pcm"] then if the Master mixing element has a playback volume, but no mute switch, and the PCM channel has playback volume and a mute switch, Gizmod.DefaultMixerVolume will be the Master mixer, and Gizmod.DefaultMixerSwitch will be the PCM mixer.

Definition at line 240 of file Alsa.cpp.

References cdbg1.

void Alsa::shutdown (  ) 

Shutdown the Alsa connection.

Shutdown the ALSA connection.

Definition at line 248 of file Alsa.cpp.

References cdbg1.

Referenced by init(), and ~Alsa().


The documentation for this class was generated from the following files:
Generated on Wed Nov 7 10:06:58 2007 for gizmod by  doxygen 1.5.3