Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

clAudio Class Reference

Class for OSS audio IO operations. More...

#include <Audio.hh>

List of all members.

Public Member Functions

 clAudio ()
 clAudio (const char *, int *, int *, int *, int)
 ~clAudio ()
bool Open (const char *, int *, int *, int *, int)
 Open device.

void Close ()
 Close device.

bool SetParams (int *, int *, int *)
 Set device parameters.

bool SetFormat (int *)
 Set format.

bool SetChannels (int *)
 Set channel count.

bool SetSampleRate (int *)
 Set samplerate.

int Read (void *, int)
 Read data to buffer.

int Write (const void *, int)
 Write data from buffer.

bool Sync ()
 Wait for buffer to be played empty.

bool Reset ()
 Stops any ongoing action and returns 'normal' state (for example stops recording).

bool Post ()
 Indicates driver that there will be pause in IO action.

int GetFragmentSize ()
 Get internal buffering fragment size.

bool SubDivide (int *)
 Undocumented feature of OSS.

bool SetFragment (int, int)
 Set buffering.

int GetFormats ()
 Get supported formats.

bool GetInBufInfo (audio_buf_info *)
 Get input buffer info.

bool GetOutBufInfo (audio_buf_info *)
 Get output buffer info.

bool GetInBufStat (count_info *)
 Get input buffer status.

bool GetOutBufStat (count_info *)
 Get output buffer status.

int GetCaps ()
 Get device capabilities.

bool SetDuplex ()
 Enable full duplex.

bool SetNonBlock ()
 Set always nonblocking io.

bool SetSynchronous ()
 Set synchronous operation.

int GetTrigger ()
 Get trigger mask.

bool SetTrigger (int)
 Set trigger mask.

bool MapInBuffer (buffmem_desc *)
 Map input buffer.

bool MapOutBuffer (buffmem_desc *)
 Map output buffer.

int GetOutDelay ()
 Get output delay.

bool GetErrorInfo (audio_errinfo *)
 Get detailed error information.

int GetVersion ()
 Get OSS version.

void DeIntStereo (const signed short *, signed short *, signed short *, unsigned int)
 Methods for (de)interleaving stereo data.

void DeIntStereo (const unsigned char *, unsigned char *, unsigned char *, unsigned int)
void IntStereo (signed short *, const signed short *, const signed short *, unsigned int)
void IntStereo (unsigned char *, const unsigned char *, const unsigned char *, unsigned int)
int GetHandle ()
 Get device handle.

int GetError ()
 Get errno code.

int GetErrno ()

Private Attributes

int iDevH
int iErrorCode


Detailed Description

Class for OSS audio IO operations.

Definition at line 49 of file Audio.hh.


Constructor & Destructor Documentation

clAudio::clAudio  ) 
 

Definition at line 43 of file Audio.cc.

References iDevH, and iErrorCode.

clAudio::clAudio const char *  ,
int *  ,
int *  ,
int *  ,
int 
 

Definition at line 50 of file Audio.cc.

References iDevH, iErrorCode, and Open().

clAudio::~clAudio  ) 
 

Definition at line 59 of file Audio.cc.

References Close().


Member Function Documentation

bool clAudio::Open const char *  ,
int *  ,
int *  ,
int *  ,
int 
 

Open device.

Note:
Check format, channels and samplerate for changes!
Parameters:
cpDevName Device name
ipFormat Format (SND_FMT_*)
ipSampleRate Samplerate
ipChannels Channel count
iType Open mode, read, write or full-duplex
Returns:
Success

Definition at line 65 of file Audio.cc.

References AUDIO_DUPLEX, AUDIO_READ, AUDIO_WRITE, iDevH, and iErrorCode.

Referenced by clSoundSrv2::AudioInThread(), clAudio(), clSoundUI::SoundInThread(), and clSoundUI::SoundOutThread().

void clAudio::Close  ) 
 

Close device.

Definition at line 118 of file Audio.cc.

References iDevH.

Referenced by clBeamAudioUI::AudioOutThread(), clSoundUI::SoundInThread(), clSoundUI::SoundOutThread(), and ~clAudio().

bool clAudio::SetParams int *  ,
int *  ,
int * 
 

Set device parameters.

Parameters:
ipFormat Format (SND_FMT_*)
ipChannels Channel count
ipSampleRate Samplerate
Returns:
Success

Definition at line 125 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetFormat int *   ) 
 

Set format.

Parameters:
ipFormat Format (SND_FMT_*)
Returns:
Success

Definition at line 147 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetChannels int *   ) 
 

Set channel count.

Parameters:
ipChannels Channel count
Returns:
Success

Definition at line 160 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetSampleRate int *   ) 
 

Set samplerate.

Parameters:
ipSampleRate Samplerate
Returns:
Success

Definition at line 172 of file Audio.cc.

References iDevH, and iErrorCode.

int clAudio::Read void *  ,
int 
 

Read data to buffer.

Parameters:
vpData Buffer
iBytes Number of bytes to read
Returns:
Number of bytes read

Definition at line 184 of file Audio.cc.

References iDevH, and iErrorCode.

Referenced by clSoundSrv2::AudioInThread().

int clAudio::Write const void *  ,
int 
 

Write data from buffer.

Parameters:
vpData Buffer
iBytes Number of bytes to write
Returns:
Number of bytes written

Definition at line 206 of file Audio.cc.

References iDevH, and iErrorCode.

Referenced by clBeamAudioUI::AudioOutThread(), main(), clSoundUI::SoundInThread(), and clSoundUI::SoundOutThread().

bool clAudio::Sync  ) 
 

Wait for buffer to be played empty.

Returns:
Success

Definition at line 228 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::Reset  ) 
 

Stops any ongoing action and returns 'normal' state (for example stops recording).

Returns:
Success

Definition at line 240 of file Audio.cc.

References iDevH, and iErrorCode.

Referenced by clSoundUI::SoundInThread(), and clSoundUI::SoundOutThread().

bool clAudio::Post  ) 
 

Indicates driver that there will be pause in IO action.

Returns:
Success

Definition at line 252 of file Audio.cc.

References iDevH, and iErrorCode.

int clAudio::GetFragmentSize  ) 
 

Get internal buffering fragment size.

Returns:
Internal fragment size in bytes

Definition at line 264 of file Audio.cc.

References iDevH, and iErrorCode.

Referenced by clSoundSrv2::AudioInThread(), and clSoundSrv::clSoundSrv().

bool clAudio::SubDivide int *   ) 
 

Undocumented feature of OSS.

Definition at line 278 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetFragment int  ,
int 
 

Set buffering.

Parameters:
iFragSize Fragment size x where fragsize = 2^x
iFragCount Number of fragments, 7fff = no limit

Definition at line 290 of file Audio.cc.

References iDevH, and iErrorCode.

Referenced by clSoundSrv2::AudioInThread().

int clAudio::GetFormats  ) 
 

Get supported formats.

Returns:
Formats, 0 on error

Definition at line 307 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::GetInBufInfo audio_buf_info *   ) 
 

Get input buffer info.

Parameters:
spInBufInfo Input buffer info (audio_buf_info struct)
Returns:
Success

Definition at line 321 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::GetOutBufInfo audio_buf_info *   ) 
 

Get output buffer info.

Parameters:
spOutBufInfo Output buffer info (audio_buf_info struct)
Returns:
Success

Definition at line 333 of file Audio.cc.

References iDevH, and iErrorCode.

Referenced by clBeamAudioUI::AudioOutThread(), main(), and clSoundUI::SoundInThread().

bool clAudio::GetInBufStat count_info *   ) 
 

Get input buffer status.

Parameters:
spInBufStat Input buffer status (count_info struct)
Returns:
Success

Definition at line 345 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::GetOutBufStat count_info *   ) 
 

Get output buffer status.

Parameters:
spOutBufStat Output buffer status (count_info struct)
Returns:
Success

Definition at line 357 of file Audio.cc.

References iDevH, and iErrorCode.

int clAudio::GetCaps  ) 
 

Get device capabilities.

Returns:
DSP_CAP_* bitmask, 0 on error

Definition at line 369 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetDuplex  ) 
 

Enable full duplex.

Returns:
Success

Definition at line 383 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetNonBlock  ) 
 

Set always nonblocking io.

Returns:
Success

Definition at line 395 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetSynchronous  ) 
 

Set synchronous operation.

Returns:
Success

Definition at line 407 of file Audio.cc.

References iDevH, and iErrorCode.

int clAudio::GetTrigger  ) 
 

Get trigger mask.

Returns:
Trigger mask, 0 on error

Definition at line 419 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::SetTrigger int   ) 
 

Set trigger mask.

Parameters:
iTrigger Trigger mask
Returns:
Success

Definition at line 433 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::MapInBuffer buffmem_desc *   ) 
 

Map input buffer.

Parameters:
spBufferInfo Mapping info (buffmem_desc struct)
Returns:
Success

Definition at line 445 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::MapOutBuffer buffmem_desc *   ) 
 

Map output buffer.

Parameters:
spBufferInfo Mapping info (buffmem_desc struct)
Returns:
Success

Definition at line 457 of file Audio.cc.

References iDevH, and iErrorCode.

int clAudio::GetOutDelay  ) 
 

Get output delay.

Returns:
Output delay (samples)

Definition at line 469 of file Audio.cc.

References iDevH, and iErrorCode.

bool clAudio::GetErrorInfo audio_errinfo *   ) 
 

Get detailed error information.

Note:
Commercial OSS driver only!
Parameters:
spErrorInfo Detailed error information
Returns:
Success

Definition at line 484 of file Audio.cc.

References iDevH, and iErrorCode.

int clAudio::GetVersion  ) 
 

Get OSS version.

Returns:
OSS version, 0 on error

Definition at line 497 of file Audio.cc.

References iDevH, and iErrorCode.

Referenced by clSoundSrv2::AudioInThread(), and clSoundSrv::clSoundSrv().

void clAudio::DeIntStereo const signed short *  ,
signed short *  ,
signed short *  ,
unsigned  int
 

Methods for (de)interleaving stereo data.

Definition at line 511 of file Audio.cc.

void clAudio::DeIntStereo const unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned  int
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 525 of file Audio.cc.

void clAudio::IntStereo signed short *  ,
const signed short *  ,
const signed short *  ,
unsigned  int
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 538 of file Audio.cc.

void clAudio::IntStereo unsigned char *  ,
const unsigned char *  ,
const unsigned char *  ,
unsigned  int
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 552 of file Audio.cc.

int clAudio::GetHandle  )  [inline]
 

Get device handle.

Returns:
File descriptor to device

Definition at line 283 of file Audio.hh.

References iDevH.

Referenced by clSoundSrv::InputExec().

int clAudio::GetError  )  [inline]
 

Get errno code.

Returns:
errno

Definition at line 289 of file Audio.hh.

References iErrorCode.

Referenced by clSoundSrv::clSoundSrv(), main(), and clSoundUI::SoundOutThread().

int clAudio::GetErrno  )  [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 291 of file Audio.hh.

References iErrorCode.


Member Data Documentation

int clAudio::iDevH [private]
 

Definition at line 51 of file Audio.hh.

Referenced by clAudio(), Close(), GetCaps(), GetErrorInfo(), GetFormats(), GetFragmentSize(), GetHandle(), GetInBufInfo(), GetInBufStat(), GetOutBufInfo(), GetOutBufStat(), GetOutDelay(), GetTrigger(), GetVersion(), MapInBuffer(), MapOutBuffer(), Open(), Post(), Read(), Reset(), SetChannels(), SetDuplex(), SetFormat(), SetFragment(), SetNonBlock(), SetParams(), SetSampleRate(), SetSynchronous(), SetTrigger(), SubDivide(), Sync(), and Write().

int clAudio::iErrorCode [private]
 

Definition at line 52 of file Audio.hh.

Referenced by clAudio(), GetCaps(), GetErrno(), GetError(), GetErrorInfo(), GetFormats(), GetFragmentSize(), GetInBufInfo(), GetInBufStat(), GetOutBufInfo(), GetOutBufStat(), GetOutDelay(), GetTrigger(), GetVersion(), MapInBuffer(), MapOutBuffer(), Open(), Post(), Read(), Reset(), SetChannels(), SetDuplex(), SetFormat(), SetFragment(), SetNonBlock(), SetParams(), SetSampleRate(), SetSynchronous(), SetTrigger(), SubDivide(), Sync(), and Write().


The documentation for this class was generated from the following files:
Generated on Sun Oct 26 19:12:11 2003 for HASAS by doxygen 1.3.3