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

#include <Stream.H>

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

Public Member Functions

 Stream ()
 Constructor. More...
 
int init (const char *device, snd_pcm_stream_t streamType, bool blockIn)
 
virtual ~Stream ()
 Destructor. More...
 
const char * getFormatName (const snd_pcm_format_t format)
 get name of PCM sample format More...
 
int open (const char *device, snd_pcm_stream_t streamType, const int block)
 
int setParams ()
 
int setSilence (void *data, unsigned int samples)
 Silence a PCM samples buffer. More...
 
int link (Stream &s)
 
int wait (int timeOut=1000)
 
int getFormatBits ()
 
- Public Member Functions inherited from ALSA::Software
 Software (void)
 
virtual ~Software (void)
 
int getSWParams ()
 
int setSWParams ()
 
int setSWThreshold (snd_pcm_uframes_t thresh)
 
int setAvailMin (snd_pcm_uframes_t cnt)
 
void * getAddress (const snd_pcm_channel_area_t *areas, snd_pcm_uframes_t offset) const
 
template<typename SAMPLE_TYPE >
int getChannelCount (const snd_pcm_channel_area_t *areas) const
 
int dumpSWParams ()
 
- Public Member Functions inherited from ALSA::Hardware
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 Attributes

bool block
 Whether to block or use NONBLOCK. More...
 
- Protected Attributes inherited from ALSA::PCM
snd_output_t * log
 The log stream if enabled. More...
 
snd_pcm_t * handle
 PCM handle. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ALSA::Hardware
int setHWParams ()
 

Detailed Description

C++ object for the ALSA stream either an input or output group of channels of a soundcard.

Definition at line 25 of file Stream.H.

Constructor & Destructor Documentation

◆ Stream()

ALSA::Stream::Stream ( )
inline

Constructor.

Definition at line 32 of file Stream.H.

◆ ~Stream()

virtual ALSA::Stream::~Stream ( )
inlinevirtual

Destructor.

Definition at line 70 of file Stream.H.

Member Function Documentation

◆ getFormatBits()

int ALSA::Stream::getFormatBits ( )
inline

Return nominal bits per a PCM sample

Returns
bits per sample, a negative error code if not applicable

Definition at line 166 of file Stream.H.

Here is the call graph for this function:

◆ getFormatName()

const char* ALSA::Stream::getFormatName ( const snd_pcm_format_t  format)
inline

get name of PCM sample format

Parameters
formatPCM sample format
Returns
ascii name of PCM sample format

Definition at line 78 of file Stream.H.

◆ init()

int ALSA::Stream::init ( const char *  device,
snd_pcm_stream_t  streamType,
bool  blockIn 
)
inline

Definition at line 36 of file Stream.H.

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

◆ link()

int ALSA::Stream::link ( Stream s)
inline

Link this stream to another stream

Parameters
sA stream to link to
Returns
0 on success otherwise a negative error code

Definition at line 144 of file Stream.H.

Here is the call graph for this function:

◆ open()

int ALSA::Stream::open ( const char *  device,
snd_pcm_stream_t  streamType,
const int  block 
)
inline

Open the stream

Parameters
deviceThe name of the device
streamTypeSND_PCM_STREAM_PLAYBACK or SND_PCM_STREAM_CAPTURE
blockWhether to open non blocking
Returns
>= 0 on success

Definition at line 88 of file Stream.H.

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

◆ setParams()

int ALSA::Stream::setParams ( )
inline

Set hardware and software params

Returns
>= 0 on success

Definition at line 101 of file Stream.H.

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

◆ setSilence()

int ALSA::Stream::setSilence ( void *  data,
unsigned int  samples 
)
inline

Silence a PCM samples buffer.

Parameters
dataBuffer
samplesSamples count
Returns
0 if successful or a negative error code

Definition at line 132 of file Stream.H.

Here is the call graph for this function:

◆ wait()

int ALSA::Stream::wait ( int  timeOut = 1000)
inline

Wait for data with a timeout

Parameters
timeOutmaximum time in milliseconds to wait, a negative value means infinity
Returns
a positive value on success otherwise a negative error code (-EPIPE for the xrun and -ESTRPIPE for the suspended status, others for general errors)
Return values
0timeout occurred
1PCM stream is ready for I/O

Definition at line 158 of file Stream.H.

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

Member Data Documentation

◆ block

bool ALSA::Stream::block
protected

Whether to block or use NONBLOCK.

Definition at line 28 of file Stream.H.


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