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

#include <Hardware.H>

Inheritance diagram for ALSA::Hardware:
[legend]
Collaboration diagram for ALSA::Hardware:
[legend]

Public Member Functions

int getHWParams ()
 
int fillParams ()
 
int resetParams ()
 
 Hardware ()
 
virtual ~Hardware ()
 
void copyFrom (snd_pcm_hw_params_t *hParamsIn)
 
int rateResample (unsigned int state)
 
int setAccess (snd_pcm_access_t access)
 
int getAccess (void)
 
int setFormat (snd_pcm_format_t format)
 
int getFormat (snd_pcm_format_t &format)
 
int getFormatPhysicalWidth ()
 
int setChannels (unsigned int cnt)
 
int getChannels ()
 
int getMaxChannels ()
 
int setSampleRate (unsigned int rrate, int dir=0)
 
int getSampleRate (int dir=0)
 
int getPeriodSize (snd_pcm_uframes_t *p, int *dir=NULL)
 
int getPeriodSize (int *dir=NULL)
 
int setPeriodSize (snd_pcm_uframes_t *p, int *dir=0)
 
int setBufSize (snd_pcm_uframes_t bufSize)
 
const char * formatDescription (const snd_pcm_format_t format) const
 
const char * getDeviceName ()
 
int dumpHWParams ()
 
- Public Member Functions inherited from ALSA::PCM
 PCM ()
 
virtual ~PCM ()
 
virtual snd_pcm_t * getPCM ()
 
snd_pcm_t ** getPCMP ()
 
int open (const char *device, snd_pcm_stream_t streamType, const int block)
 
int close ()
 
int drop ()
 
int drain ()
 
int reset ()
 
void enableLog ()
 
int logEnabled ()
 
int dumpStatus ()
 
int dumpPCM ()
 
int dumpSetup ()
 
int dumpHWSetup ()
 
int dumpSWSetup ()
 
int start ()
 
snd_pcm_state_t getState ()
 
const char * getStateName ()
 
bool prepared ()
 
bool opened ()
 
bool isSetup ()
 
bool running ()
 
bool hasXrun ()
 
bool draining ()
 
bool paused ()
 
bool suspended ()
 
bool disconnected ()
 

Protected Member Functions

int setHWParams ()
 

Private Attributes

snd_pcm_hw_params_t * hParams
 PCM params. More...
 

Additional Inherited Members

- Protected Attributes inherited from ALSA::PCM
snd_output_t * log
 The log stream if enabled. More...
 
snd_pcm_t * handle
 PCM handle. More...
 

Detailed Description

Hardware class for the ALSA lib, representing one sound card.

Definition at line 26 of file Hardware.H.

Constructor & Destructor Documentation

◆ Hardware()

ALSA::Hardware::Hardware ( )
inline

Definition at line 67 of file Hardware.H.

◆ ~Hardware()

virtual ALSA::Hardware::~Hardware ( )
inlinevirtual

Definition at line 74 of file Hardware.H.

Member Function Documentation

◆ copyFrom()

void ALSA::Hardware::copyFrom ( snd_pcm_hw_params_t *  hParamsIn)
inline

Copy the input hw_params to the class

Parameters
hParamsInthe hw_params to copy

Definition at line 83 of file Hardware.H.

Here is the caller graph for this function:

◆ dumpHWParams()

int ALSA::Hardware::dumpHWParams ( )
inline

Definition at line 330 of file Hardware.H.

Here is the call graph for this function:

◆ fillParams()

int ALSA::Hardware::fillParams ( )
inline

Fill params with a full configuration space for a PCM. Note you have to call setAccess, setFormat, setChannels, setSampleRate if you call this.

Returns
>= 0 on success

Definition at line 51 of file Hardware.H.

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

◆ formatDescription()

const char* ALSA::Hardware::formatDescription ( const snd_pcm_format_t  format) const
inline
Examples:
ALSAExternalPluginTest.C.

Definition at line 318 of file Hardware.H.

◆ getAccess()

int ALSA::Hardware::getAccess ( void  )
inline

Get the access mode for the hardware

Returns
<0 on error or the access mode

Definition at line 116 of file Hardware.H.

◆ getChannels()

int ALSA::Hardware::getChannels ( )
inline

Get the channel count

Returns
>= 0 on success returns the channel count

Definition at line 222 of file Hardware.H.

Here is the caller graph for this function:

◆ getDeviceName()

const char* ALSA::Hardware::getDeviceName ( )
inline

Get the name of the pcm device

Returns
The device name
Examples:
ALSACaptureTest.C, and ALSAPlaybackTest.C.

Definition at line 325 of file Hardware.H.

Here is the call graph for this function:

◆ getFormat()

int ALSA::Hardware::getFormat ( snd_pcm_format_t &  format)
inline

Get the format from a configuration space

Parameters
paramsConfiguration space
formatreturned format
Returns
format otherwise a negative error code if the configuration space does not contain a single value

Definition at line 195 of file Hardware.H.

Here is the caller graph for this function:

◆ getFormatPhysicalWidth()

int ALSA::Hardware::getFormatPhysicalWidth ( )
inline

Get the bits per sample.

Returns
<0 on error or the bits per sample.

Definition at line 202 of file Hardware.H.

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

◆ getHWParams()

int ALSA::Hardware::getHWParams ( )
inline

Set the hardware params

Returns
>= 0 on success

Definition at line 42 of file Hardware.H.

Here is the call graph for this function:

◆ getMaxChannels()

int ALSA::Hardware::getMaxChannels ( )
inline

Get the maximum number of channels for this device.

Returns
<0 on error, the maximum number of channels this device can drive.

Definition at line 234 of file Hardware.H.

Here is the call graph for this function:

◆ getPeriodSize() [1/2]

int ALSA::Hardware::getPeriodSize ( snd_pcm_uframes_t *  p,
int *  dir = NULL 
)
inline

Get the period size

Parameters
pReturned approximate period size in frames
dirThe direction to search in (-1,0,1)
Returns
>= 0 on success

Definition at line 275 of file Hardware.H.

Here is the caller graph for this function:

◆ getPeriodSize() [2/2]

int ALSA::Hardware::getPeriodSize ( int *  dir = NULL)
inline

Get the period size

Parameters
pReturned approximate period size in frames
dirThe direction to search in (-1,0,1)
Returns
>= 0 on success

Definition at line 284 of file Hardware.H.

Here is the call graph for this function:

◆ getSampleRate()

int ALSA::Hardware::getSampleRate ( int  dir = 0)
inline

Get the sample rate

Parameters
rateThe current sample rate.
dirThe direction to search in (-1,0,1)
Returns
>= 0 on success

Definition at line 261 of file Hardware.H.

Here is the caller graph for this function:

◆ rateResample()

int ALSA::Hardware::rateResample ( unsigned int  state)
inline

Alter the sample rate resample.

Parameters
stateTrue to resample and fals to not resample.
Returns
>= 0 on success

Definition at line 91 of file Hardware.H.

Here is the call graph for this function:

◆ resetParams()

int ALSA::Hardware::resetParams ( )
inline

Reset the params with a full configuration space for a PCM. Note you have to call setAccess, setFormat, setChannels, setSampleRate if you call this.

Returns
>= 0 on success

Definition at line 63 of file Hardware.H.

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

◆ setAccess()

int ALSA::Hardware::setAccess ( snd_pcm_access_t  access)
inline

Set the type of channel layout in the buffer

Parameters
accessis the type of channel layout, one of SND_PCM_ACCESS_MMAP_INTERLEAVED mmap access with simple interleaved channels SND_PCM_ACCESS_MMAP_NONINTERLEAVED mmap access with simple non interleaved channels SND_PCM_ACCESS_MMAP_COMPLEX mmap access with complex placement SND_PCM_ACCESS_RW_INTERLEAVED snd_pcm_readi/snd_pcm_writei access SND_PCM_ACCESS_RW_NONINTERLEAVED snd_pcm_readn/snd_pcm_writen access
Returns
>= 0 on success

Definition at line 105 of file Hardware.H.

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

◆ setBufSize()

int ALSA::Hardware::setBufSize ( snd_pcm_uframes_t  bufSize)
inline

Set the buffer size

Parameters
thedesired buffer size
Returns
<0 on error.

Definition at line 303 of file Hardware.H.

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

◆ setChannels()

int ALSA::Hardware::setChannels ( unsigned int  cnt)
inline

Set the number of channels

Parameters
cntThe number of channels.
Returns
>= 0 on success

Definition at line 214 of file Hardware.H.

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

◆ setFormat()

int ALSA::Hardware::setFormat ( snd_pcm_format_t  format)
inline

Set the sample type

Parameters
formatis the sample type
Returns
>= 0 on success SND_PCM_FORMAT_S8 Signed 8 bit SND_PCM_FORMAT_U8 Unsigned 8 bit SND_PCM_FORMAT_S16_LE Signed 16 bit Little Endian SND_PCM_FORMAT_S16_BE Signed 16 bit Big Endian SND_PCM_FORMAT_U16_LE Unsigned 16 bit Little Endian SND_PCM_FORMAT_U16_BE Unsigned 16 bit Big Endian SND_PCM_FORMAT_S24_LE Signed 24 bit Little Endian using low three bytes in 32-bit word SND_PCM_FORMAT_S24_BE Signed 24 bit Big Endian using low three bytes in 32-bit word SND_PCM_FORMAT_U24_LE Unsigned 24 bit Little Endian using low three bytes in 32-bit word SND_PCM_FORMAT_U24_BE Unsigned 24 bit Big Endian using low three bytes in 32-bit word SND_PCM_FORMAT_S32_LE Signed 32 bit Little Endian SND_PCM_FORMAT_S32_BE Signed 32 bit Big Endian SND_PCM_FORMAT_U32_LE Unsigned 32 bit Little Endian SND_PCM_FORMAT_U32_BE Unsigned 32 bit Big Endian SND_PCM_FORMAT_FLOAT_LE Float 32 bit Little Endian, Range -1.0 to 1.0 SND_PCM_FORMAT_FLOAT_BE Float 32 bit Big Endian, Range -1.0 to 1.0 SND_PCM_FORMAT_FLOAT64_LE Float 64 bit Little Endian, Range -1.0 to 1.0 SND_PCM_FORMAT_FLOAT64_BE Float 64 bit Big Endian, Range -1.0 to 1.0 SND_PCM_FORMAT_IEC958_SUBFRAME_LE IEC-958 Little Endian SND_PCM_FORMAT_IEC958_SUBFRAME_BE IEC-958 Big Endian SND_PCM_FORMAT_MU_LAW Mu-Law SND_PCM_FORMAT_A_LAW A-Law SND_PCM_FORMAT_IMA_ADPCM Ima-ADPCM SND_PCM_FORMAT_MPEG MPEG SND_PCM_FORMAT_GSM GSM SND_PCM_FORMAT_SPECIAL Special SND_PCM_FORMAT_S24_3LE Signed 24bit Little Endian in 3bytes format SND_PCM_FORMAT_S24_3BE Signed 24bit Big Endian in 3bytes format SND_PCM_FORMAT_U24_3LE Unsigned 24bit Little Endian in 3bytes format SND_PCM_FORMAT_U24_3BE Unsigned 24bit Big Endian in 3bytes format SND_PCM_FORMAT_S20_3LE Signed 20bit Little Endian in 3bytes format SND_PCM_FORMAT_S20_3BE Signed 20bit Big Endian in 3bytes format SND_PCM_FORMAT_U20_3LE Unsigned 20bit Little Endian in 3bytes format SND_PCM_FORMAT_U20_3BE Unsigned 20bit Big Endian in 3bytes format SND_PCM_FORMAT_S18_3LE Signed 18bit Little Endian in 3bytes format SND_PCM_FORMAT_S18_3BE Signed 18bit Big Endian in 3bytes format SND_PCM_FORMAT_U18_3LE Unsigned 18bit Little Endian in 3bytes format SND_PCM_FORMAT_U18_3BE Unsigned 18bit Big Endian in 3bytes format SND_PCM_FORMAT_G723_24 G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes SND_PCM_FORMAT_G723_24_1B G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte SND_PCM_FORMAT_G723_40 G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes SND_PCM_FORMAT_G723_40_1B G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte SND_PCM_FORMAT_DSD_U8 Direct Stream Digital (DSD) in 1-byte samples (x8) SND_PCM_FORMAT_DSD_U16_LE Direct Stream Digital (DSD) in 2-byte samples (x16)

SND_PCM_FORMAT_S16 Signed 16 bit CPU endian SND_PCM_FORMAT_U16 Unsigned 16 bit CPU endian SND_PCM_FORMAT_S24 Signed 24 bit CPU endian SND_PCM_FORMAT_U24 Unsigned 24 bit CPU endian SND_PCM_FORMAT_S32 Signed 32 bit CPU endian SND_PCM_FORMAT_U32 Unsigned 32 bit CPU endian SND_PCM_FORMAT_FLOAT Float 32 bit CPU endian SND_PCM_FORMAT_FLOAT64 Float 64 bit CPU endian SND_PCM_FORMAT_IEC958_SUBFRAME IEC-958 CPU Endian

Definition at line 182 of file Hardware.H.

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

◆ setHWParams()

int ALSA::Hardware::setHWParams ( )
inlineprotected

Set the hardware params

Returns
>= 0 on success

Definition at line 33 of file Hardware.H.

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

◆ setPeriodSize()

int ALSA::Hardware::setPeriodSize ( snd_pcm_uframes_t *  p,
int *  dir = 0 
)
inline

Set the period size

Parameters
papproximate period size in frames
dirThe direction to search in (-1,0,1)
Returns
>= 0 on success

Definition at line 294 of file Hardware.H.

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

◆ setSampleRate()

int ALSA::Hardware::setSampleRate ( unsigned int  rrate,
int  dir = 0 
)
inline

Set the sample rate closest to the desired rate.

Parameters
rrateThe desired sample rate.
dirThe direction to search in (-1,0,1)
Returns
>= 0 on success

Definition at line 248 of file Hardware.H.

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

Member Data Documentation

◆ hParams

snd_pcm_hw_params_t* ALSA::Hardware::hParams
private

PCM params.

Definition at line 27 of file Hardware.H.


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