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

#include <Playback.H>

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

Public Member Functions

 Playback (const char *devName)
 
 Playback ()
 
virtual ~Playback (void)
 
void open (const char *devName="default")
 
int writeBuf (void **buffers, size_t len, int ch)
 
template<typename Derived >
int writeBufN (const Eigen::DenseBase< Derived > &audioData)
 
int writeBuf (char *bufferIn, size_t len)
 
template<typename Derived >
int writeBuf (const Eigen::DenseBase< Derived > &audioData)
 
template<typename Derived >
Playbackoperator<< (const Eigen::DenseBase< Derived > &audioData)
 
- Public Member Functions inherited from ALSA::Stream
 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 ()
 

Private Attributes

std::vector< void * > buffer
 Non interleaved buffer pointers. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ALSA::Hardware
int setHWParams ()
 
- Protected Attributes inherited from ALSA::Stream
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...
 

Detailed Description

The output channels of this sound card

Examples:
ALSAPlaybackTest.C.

Definition at line 26 of file Playback.H.

Constructor & Destructor Documentation

◆ Playback() [1/2]

ALSA::Playback::Playback ( const char *  devName)
inline

Definition at line 29 of file Playback.H.

Here is the call graph for this function:

◆ Playback() [2/2]

ALSA::Playback::Playback ( )
inline

Definition at line 33 of file Playback.H.

Here is the call graph for this function:

◆ ~Playback()

virtual ALSA::Playback::~Playback ( void  )
inlinevirtual

Definition at line 37 of file Playback.H.

Member Function Documentation

◆ open()

void ALSA::Playback::open ( const char *  devName = "default")
inline

Definition at line 40 of file Playback.H.

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

◆ operator<<()

template<typename Derived >
Playback& ALSA::Playback::operator<< ( const Eigen::DenseBase< Derived > &  audioData)
inline

Using known parameters from the Eigen densebase, write the audio out.

Parameters
audioDataOne channel per column
Returns
A reference to this instance for further use.

Definition at line 144 of file Playback.H.

Here is the call graph for this function:

◆ writeBuf() [1/3]

int ALSA::Playback::writeBuf ( void **  buffers,
size_t  len,
int  ch 
)
inline

Write audio data to a buffer, returning error or the number written

Parameters
buffersThe buffer to write to the pcm device - non-interleaved data
lenThe number of frames to write
chThe number of channels (buffer must be of size ch)
Returns
NO_ERROR on success an error otherwise

Definition at line 54 of file Playback.H.

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

◆ writeBuf() [2/3]

int ALSA::Playback::writeBuf ( char *  bufferIn,
size_t  len 
)
inline

Write audio data to a buffer, returning error or the number written

Parameters
bufferThe buffer to write to the pcm device - interleaved data
lenThe number of frames to write
Returns
NO_ERROR on success an error otherwise

Definition at line 101 of file Playback.H.

Here is the call graph for this function:

◆ writeBuf() [3/3]

template<typename Derived >
int ALSA::Playback::writeBuf ( const Eigen::DenseBase< Derived > &  audioData)
inline

Method to write the audio buffer to the PCM device. The number of frames written is taken from audioData.rows().

Parameters
audioDataThe audio data to write out.

Definition at line 135 of file Playback.H.

Here is the call graph for this function:

◆ writeBufN()

template<typename Derived >
int ALSA::Playback::writeBufN ( const Eigen::DenseBase< Derived > &  audioData)
inline

Non-interleaved writes.

Parameters
audioDataRowMajor Matrix
Returns
NO_ERROR on success an error otherwise

Definition at line 87 of file Playback.H.

Here is the call graph for this function:

Member Data Documentation

◆ buffer

std::vector<void *> ALSA::Playback::buffer
private

Non interleaved buffer pointers.

Definition at line 27 of file Playback.H.


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