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

OSSDevice Class Reference

OSS audio device. More...

#include <DeviceOSS.h>

Inheritance diagram for OSSDevice:

Device List of all members.

Public Member Functions

 OSSDevice ()
 Constructor.

virtual ~OSSDevice ()
 Destructor.

virtual const wxString & Name () const
 Get the name of the device.

virtual bool Init (const format_ex_t &fmt, DeviceCallback &callback)
 Open the device.

virtual void Play ()
 Start playback.

virtual void Pause ()
 Pause playback.

virtual void Done ()
 Close the device.

virtual samples_t GetPosition ()
 Get current position.

virtual void Configure (wxWindow *parent)
 Open configure dialog.


Static Public Member Functions

DeviceRegisterDevice ()
 Create device object instance.


Private Member Functions

void done ()
 Cleanup.


Private Attributes

DeviceCallbackcb
 Data callback.

format_ex_t pfmt
 Playback format.

pthread_t play
 Playback thread.

pthread_t push
 Push thread.

wxString pdev_name
 Device node filename.

int pdev
 Device node file descriptor.

bool opened
 Opened flag.

bool playing
 Playing flag.

int initstate
sem_t play_sem
 Playback semaphore.

sem_t push_sem
 Push semaphore.

pthread_mutex_t buf_mutex
 Shared structures mutex.

size_t buf_count
 Number of cyclic buffer blocks.

size_t buf_len
 Cyclic buffer length (bytes).

size_t buf_start
 Starting data offset of the cyclic buffer.

size_t buf_size
 Size of data in the cyclic buffer.

size_t latency
 Cyclic buffer block size.

void * buf
 Cyclic buffer.

samples_t position
 Buffer position.

samples_t rpos
 Real-time (playback) position.

int oldpos
 Previous real-time position by SNDCTL_DSP_GETOPTR.


Friends

void * play_thread (void *data)
 Playback thread code.

void * push_thread (void *data)
 Push thread code.


Detailed Description

OSS audio device.

Device for accessing Open Sound System devices (usually /dev/dsp). Linux/unix specific.

Uses pthreads.


Constructor & Destructor Documentation

OSSDevice::OSSDevice  ) 
 

Constructor.

Create OSS device.

OSSDevice::~OSSDevice  )  [virtual]
 

Destructor.

Cleanup.


Member Function Documentation

void OSSDevice::Configure wxWindow *  parent  )  [virtual]
 

Open configure dialog.

Implements Device.

void OSSDevice::done  )  [private]
 

Cleanup.

Stop playback (if playing), close the wave device, dispose threads and buffers, cleanup.

void OSSDevice::Done  )  [virtual]
 

Close the device.

Stop playback, close device and do cleanup.

Implements Device.

samples_t OSSDevice::GetPosition  )  [virtual]
 

Get current position.

Get the index of the sample currently playing. The accuracy depends on the low-level driver capabilities.

Returns:
Position in samples.

Implements Device.

bool OSSDevice::Init const format_ex_t fmt,
DeviceCallback callback
[virtual]
 

Open the device.

Prepare the device for playback.

Parameters:
fmt Playback format.
callback Callback object for wave data generation.
Returns:
True on success.

Implements Device.

const wxString & OSSDevice::Name  )  const [virtual]
 

Get the name of the device.

Returns:
Static reference to a string describing this device.

Implements Device.

void OSSDevice::Pause  )  [virtual]
 

Pause playback.

Pause (or resume paused) playback.

Implements Device.

void OSSDevice::Play  )  [virtual]
 

Start playback.

Start the playback of an initialized device.

Implements Device.

Device * OSSDevice::RegisterDevice  )  [static]
 

Create device object instance.

Returns:
An object instance of this device.


Friends And Related Function Documentation

void* play_thread void *  data  )  [friend]
 

Playback thread code.

This thread plays the head of the cyclic buffer with the wave device.

Parameters:
data Unused.
Returns:
Unused.

void* push_thread void *  data  )  [friend]
 

Push thread code.

This thread uses the supplied callback function to generate wave data and push it to the cyclic buffer.

Parameters:
data Unused.
Returns:
Unused.


Member Data Documentation

void* OSSDevice::buf [private]
 

Cyclic buffer.

size_t OSSDevice::buf_count [private]
 

Number of cyclic buffer blocks.

size_t OSSDevice::buf_len [private]
 

Cyclic buffer length (bytes).

pthread_mutex_t OSSDevice::buf_mutex [private]
 

Shared structures mutex.

size_t OSSDevice::buf_size [private]
 

Size of data in the cyclic buffer.

size_t OSSDevice::buf_start [private]
 

Starting data offset of the cyclic buffer.

DeviceCallback* OSSDevice::cb [private]
 

Data callback.

int OSSDevice::initstate [private]
 

size_t OSSDevice::latency [private]
 

Cyclic buffer block size.

int OSSDevice::oldpos [private]
 

Previous real-time position by SNDCTL_DSP_GETOPTR.

bool OSSDevice::opened [private]
 

Opened flag.

int OSSDevice::pdev [private]
 

Device node file descriptor.

wxString OSSDevice::pdev_name [private]
 

Device node filename.

format_ex_t OSSDevice::pfmt [private]
 

Playback format.

pthread_t OSSDevice::play [private]
 

Playback thread.

sem_t OSSDevice::play_sem [private]
 

Playback semaphore.

bool OSSDevice::playing [private]
 

Playing flag.

samples_t OSSDevice::position [private]
 

Buffer position.

pthread_t OSSDevice::push [private]
 

Push thread.

sem_t OSSDevice::push_sem [private]
 

Push semaphore.

samples_t OSSDevice::rpos [private]
 

Real-time (playback) position.


The documentation for this class was generated from the following files:
Generated on Wed Jul 28 17:17:43 2004 for FinalMix by doxygen 1.3.5