CFugue
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CFugue::MIDIDriverAlsa Class Reference

MIDI Driver for Linux Alsa based machines More...

#include <AlsaDriver.h>

Inherits MIDIDriver.

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

Definition at line 30 of file AlsaDriver.h.

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.

Definition at line 79 of file AlsaDriver.h.

Member Function Documentation

bool CFugue::MIDIDriverAlsa::OpenMIDIInPort ( int  id)

Opens the MIDI input port with the given ID

Returns
false if the given input port cannot be opened

Definition at line 35 of file AlsaDriver.cpp.

bool CFugue::MIDIDriverAlsa::OpenMIDIOutPort ( int  id)

Opens the MIDI output port with the given ID

Returns
false if the given output port cannot be opened

Definition at line 70 of file AlsaDriver.cpp.

bool CFugue::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

Definition at line 151 of file AlsaDriver.cpp.

void CFugue::MIDIDriverAlsa::StopTimer ( )

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.

Definition at line 173 of file AlsaDriver.cpp.

void CFugue::MIDIDriverAlsa::WaitTillDone ( )

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.

Definition at line 161 of file AlsaDriver.cpp.


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

CFugue, the C++ Music Programming Library © Copyright 2009 Cenacle Research India Private Limited Gopalakrishna Palem