gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
ALSA::Mixer Class Reference

#include <Mixer.H>

Collaboration diagram for ALSA::Mixer:
[legend]

Public Member Functions

 Mixer ()
 
virtual ~Mixer ()
 
int open ()
 
int close ()
 
int attach (std::string card)
 
int registerMixer ()
 
int load ()
 
int openCard (std::string card)
 
void scanMixer ()
 
std::string getState ()
 
std::string getElementState (std::string name)
 
int getElementIndex (std::string name)
 
long setPlaybackVol (std::string name, long v)
 
long setPlaybackChVol (std::string name, snd_mixer_selem_channel_id_t channel, long v)
 
std::string setPlaybackVolJSON (std::string name, long v)
 
std::string setPlaybackChVolJSON (std::string name, snd_mixer_selem_channel_id_t channel, long v)
 
std::string setPlaybackChVolJSON (std::string name, int channel, long v)
 
int setPlaybackVolDB (std::string name, double &dB)
 
int setPlaybackChVolDB (std::string name, snd_mixer_selem_channel_id_t channel, double &dB)
 
std::string setPlaybackVolDBJSON (std::string name, double dB)
 
std::string setPlaybackChVolDBJSON (std::string name, snd_mixer_selem_channel_id_t channel, double dB)
 
std::string setPlaybackChVolDBJSON (std::string name, int channel, double dB)
 
int setPlaybackSwitch (std::string name, int v)
 
std::string setPlaybackSwitchJSON (std::string name, int v)
 
long setCaptureVol (std::string name, long v)
 
long setCaptureVol (std::string name, snd_mixer_selem_channel_id_t channel, long v)
 
std::string setCaptureVolJSON (std::string name, long v)
 
std::string setCaptureChVolJSON (std::string name, snd_mixer_selem_channel_id_t channel, long v)
 
std::string setCaptureChVolJSON (std::string name, int channel, long v)
 
int setCaptureVolDB (std::string name, double &dB)
 
int setCaptureChVolDB (std::string name, snd_mixer_selem_channel_id_t channel, double &dB)
 
std::string setCaptureVolDBJSON (std::string name, double dB)
 
std::string setCaptureChVolDBJSON (std::string name, snd_mixer_selem_channel_id_t channel, double dB)
 
std::string setCaptureChVolDBJSON (std::string name, int channel, double dB)
 
int setCaptureSwitch (std::string name, int v)
 
std::string setCaptureSwitchJSON (std::string name, int v)
 

Private Attributes

snd_mixer_t * handle
 
std::vector< MixerElementmixerElements
 The vector of all mixer elements. More...
 

Friends

std::ostream & operator<< (std::ostream &os, Mixer &m)
 

Detailed Description

Class to alter the ALSA hardware mixer

Definition at line 25 of file Mixer.H.

Constructor & Destructor Documentation

◆ Mixer()

ALSA::Mixer::Mixer ( )
inline

Definition at line 30 of file Mixer.H.

◆ ~Mixer()

virtual ALSA::Mixer::~Mixer ( )
inlinevirtual

Definition at line 34 of file Mixer.H.

Here is the call graph for this function:

Member Function Documentation

◆ attach()

int ALSA::Mixer::attach ( std::string  card)
inline

Attach to the card for setting the mixer

Parameters
cardThe card to open, e.g. default, hw:0, etc.
Returns
0 on success, otherwise the error.

Definition at line 69 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ close()

int ALSA::Mixer::close ( )
inline

Free the mixer handle.

Returns
0 on success, otherwise the error.

Definition at line 54 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getElementIndex()

int ALSA::Mixer::getElementIndex ( std::string  name)
inline

Given a mixer element name, return the index of the element in the mixerElements

Definition at line 175 of file Mixer.H.

Here is the caller graph for this function:

◆ getElementState()

std::string ALSA::Mixer::getElementState ( std::string  name)
inline

Get the ALSA mixer information in a JSON string

Parameters
nameThe name of the mixer element to get the state of
Returns
Mixer state in a JSON string.

Definition at line 163 of file Mixer.H.

Here is the call graph for this function:

◆ getState()

std::string ALSA::Mixer::getState ( )
inline

Get the ALSA mixer information in a JSON string

Returns
Mixer state in a JSON string.

Definition at line 153 of file Mixer.H.

◆ load()

int ALSA::Mixer::load ( )
inline

load the mixer elements

Returns
0 on success, otherwise the error.

Definition at line 96 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

int ALSA::Mixer::open ( )
inline

Acquire the mixer handle.

Returns
0 on success, otherwise the error.

Definition at line 42 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ openCard()

int ALSA::Mixer::openCard ( std::string  card)
inline

Open a card given the device name

Parameters
cardThe device name
Returns
<0 on failure

Definition at line 110 of file Mixer.H.

Here is the call graph for this function:

◆ registerMixer()

int ALSA::Mixer::registerMixer ( )
inline

register the simple mixer element class

Returns
0 on success, otherwise the error.

Definition at line 83 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scanMixer()

void ALSA::Mixer::scanMixer ( )
inline

Scan the mixer to find capabilites and available controls. Upon completion, all playback and capture mixer elements are populated

Definition at line 129 of file Mixer.H.

Here is the call graph for this function:

◆ setCaptureChVolDB()

int ALSA::Mixer::setCaptureChVolDB ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
double &  dB 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set - the value is updated on return
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 425 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCaptureChVolDBJSON() [1/2]

std::string ALSA::Mixer::setCaptureChVolDBJSON ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
double  dB 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned in the JSON string

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set - the value is not updated on return
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 453 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCaptureChVolDBJSON() [2/2]

std::string ALSA::Mixer::setCaptureChVolDBJSON ( std::string  name,
int  channel,
double  dB 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned in the JSON string

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set - the value is not updated on return
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 469 of file Mixer.H.

Here is the call graph for this function:

◆ setCaptureChVolJSON() [1/2]

std::string ALSA::Mixer::setCaptureChVolJSON ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
long  v 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set.
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 387 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCaptureChVolJSON() [2/2]

std::string ALSA::Mixer::setCaptureChVolJSON ( std::string  name,
int  channel,
long  v 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set.
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 403 of file Mixer.H.

Here is the call graph for this function:

◆ setCaptureSwitch()

int ALSA::Mixer::setCaptureSwitch ( std::string  name,
int  v 
)
inline

Set the switch state of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe switch state to set.
Returns
<0 on error otherwise, the current state of the mixer element's switch

Definition at line 477 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCaptureSwitchJSON()

std::string ALSA::Mixer::setCaptureSwitchJSON ( std::string  name,
int  v 
)
inline

Set the switch state of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe switch state to set.
Returns
JSON object, with val<0 on error otherwise, the current state of the mixer element's swtich

Definition at line 489 of file Mixer.H.

Here is the call graph for this function:

◆ setCaptureVol() [1/2]

long ALSA::Mixer::setCaptureVol ( std::string  name,
long  v 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe volume to set.
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 346 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCaptureVol() [2/2]

long ALSA::Mixer::setCaptureVol ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
long  v 
)
inline

Set the volume of a mixer element's channel, given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set.
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 359 of file Mixer.H.

Here is the call graph for this function:

◆ setCaptureVolDB()

int ALSA::Mixer::setCaptureVolDB ( std::string  name,
double &  dB 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe volume to set - the value is updated on return
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 412 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCaptureVolDBJSON()

std::string ALSA::Mixer::setCaptureVolDBJSON ( std::string  name,
double  dB 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned in the JSON string

Parameters
nameThe name of the mixer element to change
vThe volume to set - the value is not updated on return
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 437 of file Mixer.H.

Here is the call graph for this function:

◆ setCaptureVolJSON()

std::string ALSA::Mixer::setCaptureVolJSON ( std::string  name,
long  v 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe volume to set.
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 371 of file Mixer.H.

Here is the call graph for this function:

◆ setPlaybackChVol()

long ALSA::Mixer::setPlaybackChVol ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
long  v 
)
inline

Set the volume of a mixer element's channel, given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set.
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 200 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlaybackChVolDB()

int ALSA::Mixer::setPlaybackChVolDB ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
double &  dB 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set - updated on return to the actual value set.
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 266 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlaybackChVolDBJSON() [1/2]

std::string ALSA::Mixer::setPlaybackChVolDBJSON ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
double  dB 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned in a JSON format

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set - not updated on return
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 294 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlaybackChVolDBJSON() [2/2]

std::string ALSA::Mixer::setPlaybackChVolDBJSON ( std::string  name,
int  channel,
double  dB 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned in a JSON format

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set - not updated on return
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 310 of file Mixer.H.

Here is the call graph for this function:

◆ setPlaybackChVolJSON() [1/2]

std::string ALSA::Mixer::setPlaybackChVolJSON ( std::string  name,
snd_mixer_selem_channel_id_t  channel,
long  v 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set.
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 228 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlaybackChVolJSON() [2/2]

std::string ALSA::Mixer::setPlaybackChVolJSON ( std::string  name,
int  channel,
long  v 
)
inline

Set the volume of a mixer element's channel given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
channelThe channel to set the volume on
vThe volume to set.
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 244 of file Mixer.H.

Here is the call graph for this function:

◆ setPlaybackSwitch()

int ALSA::Mixer::setPlaybackSwitch ( std::string  name,
int  v 
)
inline

Set the switch state of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe state to set.
Returns
<0 on error otherwise, the current state of the mixer element's switch.

Definition at line 319 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlaybackSwitchJSON()

std::string ALSA::Mixer::setPlaybackSwitchJSON ( std::string  name,
int  v 
)
inline

Set the switch state of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe switch state to set - not updated on return
Returns
JSON object, with val<0 on error otherwise, the current state of the mixer element's switch

Definition at line 331 of file Mixer.H.

Here is the call graph for this function:

◆ setPlaybackVol()

long ALSA::Mixer::setPlaybackVol ( std::string  name,
long  v 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe volume to set.
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 187 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlaybackVolDB()

int ALSA::Mixer::setPlaybackVolDB ( std::string  name,
double &  dB 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe volume to set - updated on return to the actual value set.
Returns
<0 on error otherwise, the current volume of the mixer element.

Definition at line 253 of file Mixer.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlaybackVolDBJSON()

std::string ALSA::Mixer::setPlaybackVolDBJSON ( std::string  name,
double  dB 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned in a JSON format

Parameters
nameThe name of the mixer element to change
vThe volume to set - not updated on return
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 278 of file Mixer.H.

Here is the call graph for this function:

◆ setPlaybackVolJSON()

std::string ALSA::Mixer::setPlaybackVolJSON ( std::string  name,
long  v 
)
inline

Set the volume of a mixer element given the name. The resulting state of the mixer element is returned

Parameters
nameThe name of the mixer element to change
vThe volume to set.
Returns
JSON object, with val<0 on error otherwise, the current volume of the mixer element.

Definition at line 212 of file Mixer.H.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
Mixer m 
)
friend

output json data to an output stream

Definition at line 142 of file Mixer.H.

Member Data Documentation

◆ handle

snd_mixer_t* ALSA::Mixer::handle
private

Definition at line 26 of file Mixer.H.

◆ mixerElements

std::vector<MixerElement> ALSA::Mixer::mixerElements
private

The vector of all mixer elements.

Definition at line 27 of file Mixer.H.


The documentation for this class was generated from the following file:
gtkIOStream: ALSA::Mixer Class Reference
GTK+ IOStream  Beta