class OssDspSource

An audio input based on /dev/dsp-like raw devices More...

Definition#include <OssDspSource.h>
InheritsAudioSource [public ], Reporter [public virtual ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods

Private Members


Detailed Description

An audio input based on /dev/dsp-like raw devices

char * fileName

fileName

[private]

int fileDescriptor

fileDescriptor

[private]

bool running

running

[private]

inline  OssDspSource ( void )
throw ( Exception )

OssDspSource

[protected]

Default constructor. Always throws an Exception.

Throws: Exception

void  init ( const char * name )
throw ( Exception )

init

[protected]

Initialize the object

Parameters:
namethe file name of the OSS DSP device.

Throws: Exception

Reimplemented from AudioSource.

void  strip ( void )
throw ( Exception )

strip

[protected]

De-iitialize the object

Throws: Exception

Reimplemented from AudioSource.

inline  OssDspSource ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 )
throw ( Exception )

OssDspSource

Constructor.

Parameters:
namethe file name of the OSS DSP device (e.g. /dev/dsp or /dev/dsp0).
sampleRatesamples per second (e.g. 44100 for 44.1kHz).
bitsPerSamplebits per sample (e.g. 16 bits).
channelnumber of channels of the audio source (e.g. 1 for mono, 2 for stereo, etc.).

Throws: Exception

inline  OssDspSource ( const OssDspSource & ds )
throw ( Exception )

OssDspSource

Copy Constructor.

Parameters:
sourcethe object to copy.

Throws: Exception

inline  ~OssDspSource ( void )
throw ( Exception )

~OssDspSource

[virtual]

Destructor.

Throws: Exception

inline OssDspSource &  operator= ( const OssDspSource & ds )
throw ( Exception )

operator=

[virtual]

Assignment operator.

Parameters:
dsthe object to assign to this one.

Returns: a reference to this object.

Throws: Exception

Reimplemented from AudioSource.

bool  isBigEndian ( void )
throw ()

isBigEndian

[const 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.

bool  open ( void )
throw ( Exception )

open

[virtual]

Open the OssDspSource. This does not put the OSS DSP device into recording mode. To start getting samples, call either canRead() or read().

Returns: true if opening was successful, false otherwise

Throws: Exception

See also: canRead, read

Reimplemented from Source.

inline bool  isOpen ( void )
throw ()

isOpen

[const virtual]

Check if the OssDspSource is open.

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

Reimplemented from Source.

bool  canRead ( unsigned int sec, unsigned int usec )
throw ( Exception )

canRead

[virtual]

Check if the OssDspSource can be read from. Blocks until the specified time for data to be available. Puts the OSS DSP device into recording mode.

Parameters:
secthe maximum seconds to block.
usecmicro seconds to block after the full seconds.

Returns: true if the OssDspSource is ready to be read from, false otherwise.

Throws: Exception

Reimplemented from Source.

unsigned int  read ( void * buf, unsigned int len )
throw ( Exception )

read

[virtual]

Read from the OssDspSource. Puts the OSS DSP device into recording mode.

Parameters:
bufthe buffer to read into.
lenthe number of bytes to read into buf

Returns: the number of bytes read (may be less than len).

Throws: Exception

Reimplemented from Source.

void  close ( void )
throw ( Exception )

close

[virtual]

Close the OssDspSource.

Throws: Exception

Reimplemented from Source.