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

MMDevice Class Reference

MM audio device. More...

#include <DeviceMM.h>

Inheritance diagram for MMDevice:

Device List of all members.

Public Member Functions

 MMDevice ()
 Constructor.

virtual ~MMDevice ()
 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.

HANDLE play
 Playback thread handle.

DWORD play_id
 Playback thread id.

HANDLE push
 Push thread handle.

DWORD push_id
 Push thread id.

HWAVEOUT handle
 Playback device handle.

bool opened
 Opended flag.

bool playing
 Playing flag.

bool paused
 Paused flag.

HANDLE buf_mutex
 Shared structures mutex.

size_t buf_count
 Number of cyclic buffer blocks.

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.

DWORD oldpos
 Previous real-time position by waveOutGetPosition.

WAVEHDR * fragments
 Wave fragments headers.


Friends

DWORD __stdcall play_thread (LPVOID data)
 Playback thread code.

DWORD __stdcall push_thread (LPVOID data)
 Push thread code.


Detailed Description

MM audio device.

Device for accessing Microsoft Windows MultiMedia sound devices.

Uses standard win32 threads.


Constructor & Destructor Documentation

MMDevice::MMDevice  ) 
 

Constructor.

Create MM device.

MMDevice::~MMDevice  )  [virtual]
 

Destructor.

Cleanup.


Member Function Documentation

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

Open configure dialog.

Show the device configure dialog.

Parameters:
parent Parent window.
Returns:
True on commit.

Implements Device.

void MMDevice::done  )  [private]
 

Cleanup.

Stop playback (if playing), close the wave device, unprepare fragments, dispose threads, cleanup.

void MMDevice::Done  )  [virtual]
 

Close the device.

Stop playback, close device and do cleanup.

Implements Device.

samples_t MMDevice::GetPosition  )  [virtual]
 

Get current position.

Get the index of the sample currently playing. The accuracy is not great and depends on the low-level MM driver.

Returns:
Position in samples.

Implements Device.

bool MMDevice::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 & MMDevice::Name  )  const [virtual]
 

Get the name of the device.

Returns:
Static reference to a string describing this device.

Implements Device.

void MMDevice::Pause  )  [virtual]
 

Pause playback.

Pause (or resume paused) playback.

Implements Device.

void MMDevice::Play  )  [virtual]
 

Start playback.

Start the playback of an initialized device.

Implements Device.

Device * MMDevice::RegisterDevice  )  [static]
 

Create device object instance.

Returns:
An object instance of this device.


Friends And Related Function Documentation

DWORD __stdcall play_thread LPVOID  data  )  [friend]
 

Playback thread code.

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

Parameters:
data Unused.
Returns:
Unused.

DWORD __stdcall push_thread LPVOID  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* MMDevice::buf [private]
 

Cyclic buffer.

size_t MMDevice::buf_count [private]
 

Number of cyclic buffer blocks.

HANDLE MMDevice::buf_mutex [private]
 

Shared structures mutex.

size_t MMDevice::buf_size [private]
 

Size of data in the cyclic buffer.

size_t MMDevice::buf_start [private]
 

Starting data offset of the cyclic buffer.

DeviceCallback* MMDevice::cb [private]
 

Data callback.

WAVEHDR* MMDevice::fragments [private]
 

Wave fragments headers.

HWAVEOUT MMDevice::handle [private]
 

Playback device handle.

size_t MMDevice::latency [private]
 

Cyclic buffer block size.

DWORD MMDevice::oldpos [private]
 

Previous real-time position by waveOutGetPosition.

bool MMDevice::opened [private]
 

Opended flag.

bool MMDevice::paused [private]
 

Paused flag.

format_ex_t MMDevice::pfmt [private]
 

Playback format.

HANDLE MMDevice::play [private]
 

Playback thread handle.

DWORD MMDevice::play_id [private]
 

Playback thread id.

bool MMDevice::playing [private]
 

Playing flag.

samples_t MMDevice::position [private]
 

Buffer position.

HANDLE MMDevice::push [private]
 

Push thread handle.

DWORD MMDevice::push_id [private]
 

Push thread id.

samples_t MMDevice::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