Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
MusicNoteLib::MIDIDriverAlsa Class Reference

MIDI Driver for Linux Alsa based machines More...

#include <AlsaDriver.h>

List of all members.

Public Types

enum  BGThreadStatus { RUNNING, COMPLETED, INVALID }

Public Member Functions

 MIDIDriverAlsa (int queue_size)
void ResetMIDIOut ()
bool StartTimer (int resolution_ms)
void WaitTillDone ()
void StopTimer ()
bool OpenMIDIInPort (int id)
bool OpenMIDIOutPort (int id)
void CloseMIDIInPort ()
 Closed any previously opened MIDI Input port.
void CloseMIDIOutPort ()
 Closed any previously opened MIDI Output port.

Protected Member Functions

bool HardwareMsgOut (const jdkmidi::MIDITimedBigMessage &msg)

Protected Attributes

std::thread * m_pThread
int timer_id
int timer_res

Detailed Description

MIDI Driver for Linux Alsa based machines


Member Enumeration Documentation

Enumerator:
RUNNING 

Async procedure is running - use WaitTillDone() to wait for completion.

COMPLETED 

Async procedure completed running - use StopTimer() to finish.

INVALID 

No background procedure running - use StartTimer() to start one.


Member Function Documentation

Opens the MIDI input port with the given ID

Returns:
false if the given input port cannot be opened

Opens the MIDI output port with the given ID

Returns:
false if the given output port cannot be opened

Referenced by MusicNoteLib::MIDIRenderer::BeginPlayAsync().

bool MusicNoteLib::MIDIDriverAlsa::StartTimer ( int  resolution_ms)

Creates a background thread to pump MIDI events at the supplied timer resolution. Use WaitTillDone() to wait till the background processing completes. Use StopTimer() after the background processing is completed, to release resources.

Parameters:
resolution_msMIDI Timer resolution in milliseconds
Returns:
false if background thread cannot be started

Referenced by MusicNoteLib::MIDIRenderer::BeginPlayAsync().

Call StopTimer() to release the resources used by the background procedure created with StartTimer(). StopTimer() Should be called after the background procedure is done (indicated by BGThreadStatus::COMPLETED). If background procedure is still running while StopTimer() is called, caller gets blocked till the background procedure completes. If no background procedure exists, returns immediately.

Referenced by MusicNoteLib::MIDIRenderer::EndPlayAsync().

Waits (blocks) till the background thread created with StartTimer() completes its processing. After StartTimer() succeeds, use WaitTillDone() followed by StopTimer(). Returns immediately if no background thread is running.

Referenced by MusicNoteLib::MIDIRenderer::WaitTillDone().


The documentation for this class was generated from the following files:

CFugue, the C++ Music Programming Library © Copyright 2009 CineFx Digital Media Pvt Ltd. Gopalakrishna Palem