Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

AlsaDspSource Class Reference

#include <AlsaDspSource.h>

Inheritance diagram for AlsaDspSource:

Inheritance graph
[legend]
Collaboration diagram for AlsaDspSource:

Collaboration graph
[legend]
List of all members.

Detailed Description

An audio input based on the ALSA sound system.

Author:
Author
darkeye
Version:
Revision
1.2

Definition at line 70 of file AlsaDspSource.h.

Public Member Functions

 AlsaDspSource (const char *name, int sampleRate=44100, int bitsPerSample=16, int channel=2) throw ( Exception )
 Constructor.
 AlsaDspSource (const AlsaDspSource &ds) throw ( Exception )
 Copy Constructor.
virtual ~AlsaDspSource (void) throw ( Exception )
 Destructor.
virtual AlsaDspSourceoperator= (const AlsaDspSource &ds) throw ( Exception )
 Assignment operator.
virtual bool isBigEndian (void) const throw ()
 Tell if the data from this source comes in big or little endian.
virtual bool open (void) throw ( Exception )
 Open the AlsaDspSource.
virtual bool isOpen (void) const throw ()
 Check if the AlsaDspSource is open.
virtual bool canRead (unsigned int sec, unsigned int usec) throw ( Exception )
 Check if the AlsaDspSource can be read from.
virtual unsigned int read (void *buf, unsigned int len) throw ( Exception )
 Read from the AlsaDspSource.
virtual void close (void) throw ( Exception )
 Close the AlsaDspSource.
virtual unsigned int getBufferTime (void) const
 Returns the buffer size in useconds.
virtual void setBufferTime (unsigned int time)
 Sets the number of useconds to buffer audio in ALSA.

Protected Member Functions

 AlsaDspSource (void) throw ( Exception )
 Default constructor.
void init (const char *name) throw ( Exception )
 Initialize the object.
void strip (void) throw ( Exception )
 De-iitialize the object.


Constructor & Destructor Documentation

AlsaDspSource::AlsaDspSource void   )  throw ( Exception ) [inline, protected]
 

Default constructor.

Always throws an Exception.

Exceptions:
Exception 

Definition at line 109 of file AlsaDspSource.h.

AlsaDspSource::AlsaDspSource const char *  name,
int  sampleRate = 44100,
int  bitsPerSample = 16,
int  channel = 2
throw ( Exception ) [inline]
 

Constructor.

Parameters:
name the PCM (e.g. "hwplug:0,0").
sampleRate samples per second (e.g. 44100 for 44.1kHz).
bitsPerSample bits per sample (e.g. 16 bits).
channel number of channels of the audio source (e.g. 1 for mono, 2 for stereo, etc.).
Exceptions:
Exception 

Definition at line 145 of file AlsaDspSource.h.

References init().

AlsaDspSource::AlsaDspSource const AlsaDspSource ds  )  throw ( Exception ) [inline]
 

Copy Constructor.

Parameters:
ds the object to copy.
Exceptions:
Exception 

Definition at line 162 of file AlsaDspSource.h.

References init().

virtual AlsaDspSource::~AlsaDspSource void   )  throw ( Exception ) [inline, virtual]
 

Destructor.

Exceptions:
Exception 

Definition at line 174 of file AlsaDspSource.h.

References strip().


Member Function Documentation

virtual bool AlsaDspSource::canRead unsigned int  sec,
unsigned int  usec
throw ( Exception ) [virtual]
 

Check if the AlsaDspSource can be read from.

Blocks until the specified time for data to be available. Puts the PCM into recording mode.

Parameters:
sec the maximum seconds to block.
usec micro seconds to block after the full seconds.
Returns:
true if the AlsaDspSource is ready to be read from, false otherwise.
Exceptions:
Exception 

Implements Source.

virtual void AlsaDspSource::close void   )  throw ( Exception ) [virtual]
 

Close the AlsaDspSource.

Exceptions:
Exception 

Implements Source.

virtual unsigned int AlsaDspSource::getBufferTime void   )  const [inline, virtual]
 

Returns the buffer size in useconds.

Returns:
the number of useconds audio will be buffered in ALSA

Definition at line 272 of file AlsaDspSource.h.

void AlsaDspSource::init const char *  name  )  throw ( Exception ) [protected]
 

Initialize the object.

Parameters:
name the PCM to open.
Exceptions:
Exception 

Referenced by AlsaDspSource(), and operator=().

virtual bool AlsaDspSource::isBigEndian void   )  const throw () [virtual]
 

Tell if the data from this source comes in big or little endian.

Returns:
true if the source is big endian, false otherwise

Reimplemented from AudioSource.

virtual bool AlsaDspSource::isOpen void   )  const throw () [inline, virtual]
 

Check if the AlsaDspSource is open.

Returns:
true if the AlsaDspSource is open, false otherwise.

Implements Source.

Definition at line 225 of file AlsaDspSource.h.

virtual bool AlsaDspSource::open void   )  throw ( Exception ) [virtual]
 

Open the AlsaDspSource.

This does not put Alsa device into recording mode. To start getting samples, call either canRead() or read().

Returns:
true if opening was successful, false otherwise
Exceptions:
Exception 
See also:
canRead

read

Implements Source.

virtual AlsaDspSource& AlsaDspSource::operator= const AlsaDspSource ds  )  throw ( Exception ) [inline, virtual]
 

Assignment operator.

Parameters:
ds the object to assign to this one.
Returns:
a reference to this object.
Exceptions:
Exception 

Definition at line 187 of file AlsaDspSource.h.

References init(), AudioSource::operator=(), and strip().

virtual unsigned int AlsaDspSource::read void *  buf,
unsigned int  len
throw ( Exception ) [virtual]
 

Read from the AlsaDspSource.

Puts the PCM into recording mode.

Parameters:
buf the buffer to read into.
len the number of bytes to read into buf
Returns:
the number of bytes read (may be less than len).
Exceptions:
Exception 

Implements Source.

virtual void AlsaDspSource::setBufferTime unsigned int  time  )  [inline, virtual]
 

Sets the number of useconds to buffer audio in ALSA.

Parameters:
time buffer time

Definition at line 283 of file AlsaDspSource.h.

void AlsaDspSource::strip void   )  throw ( Exception ) [protected]
 

De-iitialize the object.

Exceptions:
Exception 

Reimplemented from AudioSource.

Referenced by operator=(), and ~AlsaDspSource().


The documentation for this class was generated from the following file:
Generated on Sat Oct 22 13:17:06 2005 for DarkIce by  doxygen 1.4.4