LowLevelMidiDriver Class Reference

#include <LowLevelMidiDriver.h>

Inheritance diagram for LowLevelMidiDriver:

MidiDriver XMidiSequenceHandler ALSAMidiDriver CoreAudioMidiDriver FluidSynthMidiDriver FMOplMidiDriver TimidityMidiDriver UnixSeqMidiDriver WindowsMidiDriver List of all members.

Public Member Functions

 LowLevelMidiDriver ()
virtual ~LowLevelMidiDriver ()
virtual int initMidiDriver (uint32 sample_rate, bool stereo)
virtual void destroyMidiDriver ()
virtual int maxSequences ()
virtual void setGlobalVolume (int vol)
virtual void startSequence (int seq_num, XMidiEventList *list, bool repeat, int vol, int branch=-1)
virtual void finishSequence (int seq_num)
virtual void pauseSequence (int seq_num)
virtual void unpauseSequence (int seq_num)
virtual void setSequenceVolume (int seq_num, int vol)
virtual void setSequenceSpeed (int seq_num, int speed)
virtual bool isSequencePlaying (int seq_num)
virtual uint32 getSequenceCallbackData (int seq_num)
virtual void produceSamples (sint16 *samples, uint32 bytes)
virtual void loadTimbreLibrary (IDataSource *, TimbreLibraryType type)

Protected Member Functions

virtual int open ()=0
virtual void close ()=0
virtual void send (uint32 message)=0
virtual void send_sysex (uint8 status, const uint8 *msg, uint16 length)
virtual void increaseThreadPriority ()
virtual void lowLevelProduceSamples (sint16 *samples, uint32 num_samples)
virtual void yield ()

Protected Attributes

uint32 sample_rate
bool stereo

Private Member Functions

sint32 peekComMessageType ()
void sendComMessage (ComMessage &message)
void waitTillNoComMessages ()
void lockComMessage ()
void unlockComMessage ()
void loadXMidiTimbreLibrary (IDataSource *ds)
void extractTimbreLibrary (XMidiEventList *eventlist)
void uploadTimbre (int bank, int timbre)
void setPatchBank (int bank, int patch)
void loadRhythmTemp (int temp)
void sendMT32SystemMessage (uint32 address_base, uint16 address_offset, uint32 len, const void *data)
bool playSequences ()
int initThreadedSynth ()
void destroyThreadedSynth ()
int threadMain ()
int initSoftwareSynth ()
void destroySoftwareSynth ()
virtual void sequenceSendEvent (uint16 sequence_id, uint32 message)
virtual void sequenceSendSysEx (uint16 sequence_id, uint8 status, const uint8 *msg, uint16 length)
virtual uint32 getTickCount (uint16 sequence_id)
virtual void handleCallbackTrigger (uint16 sequence_id, uint8 data)
int protectChannel (uint16 sequence_id, int chan, bool protect)
int lockChannel (uint16 sequence_id, int chan, bool lock)
int unlockAndUnprotectChannel (uint16 sequence_id)
void muteAllChannels ()

Static Private Member Functions

static int threadMain_Static (void *data)

Private Attributes

bool uploading_timbres
std::queue< ComMessagemessages
SDL_mutex * mutex
SDL_mutex * cbmutex
SDL_cond * cond
bool playing [LLMD_NUM_SEQ]
sint32 callback_data [LLMD_NUM_SEQ]
int global_volume
uint32 xmidi_clock
int chan_locks [16]
int chan_map [LLMD_NUM_SEQ][16]
XMidiSequencesequences [LLMD_NUM_SEQ]
int next_sysex
uint32 total_seconds
uint32 samples_this_second
uint32 samples_per_iteration
SDL_Thread * thread
MT32Patch ** mt32_patch_banks [128]
MT32Timbre ** mt32_timbre_banks [128]
MT32Rhythmmt32_rhythm_bank [128]
int mt32_timbre_used [64][2]
int mt32_bank_sel [LLMD_NUM_SEQ][16]
int mt32_patch_bank_sel [128]

Static Private Attributes

static const MT32Patch mt32_patch_template

Classes

struct  ComMessage
struct  MT32Patch
struct  MT32Rhythm
struct  MT32Timbre

Detailed Description

An Abstract implementation of MidiDriver for Simple Low Level support of Midi playback

Note:
An implementation of LowLevelMidiDriver needs to implement the open(), close() and send() functions. Implementing increaseThreadPriority() is optional, however it is strongly recommended that it is implemented. If it's not implemented, the main Pentagram thread MAY use too much CPU time and cause timing problems. Similar, implemeting yield() is a good idea too.

Definition at line 43 of file LowLevelMidiDriver.h.


Constructor & Destructor Documentation

LowLevelMidiDriver::LowLevelMidiDriver (  ) 

Definition at line 141 of file LowLevelMidiDriver.cpp.

LowLevelMidiDriver::~LowLevelMidiDriver (  )  [virtual]

Definition at line 147 of file LowLevelMidiDriver.cpp.

References MidiDriver::initialized, perr, and thread.


Member Function Documentation

virtual void LowLevelMidiDriver::close (  )  [protected, pure virtual]

Close the Midi Device.

Implemented in ALSAMidiDriver, CoreAudioMidiDriver, FluidSynthMidiDriver, FMOplMidiDriver, TimidityMidiDriver, UnixSeqMidiDriver, and WindowsMidiDriver.

Referenced by destroySoftwareSynth(), and threadMain().

void LowLevelMidiDriver::destroyMidiDriver (  )  [virtual]

Destroy the driver.

Implements MidiDriver.

Definition at line 218 of file LowLevelMidiDriver.cpp.

References cbmutex, cond, destroySoftwareSynth(), destroyThreadedSynth(), MidiDriver::initialized, MidiDriver::isSampleProducer(), mutex, thread, and waitTillNoComMessages().

Referenced by initMidiDriver().

void LowLevelMidiDriver::destroySoftwareSynth (  )  [private]

Definition at line 634 of file LowLevelMidiDriver.cpp.

References close(), sendComMessage(), and waitTillNoComMessages().

Referenced by destroyMidiDriver().

void LowLevelMidiDriver::destroyThreadedSynth (  )  [private]

Definition at line 451 of file LowLevelMidiDriver.cpp.

References lockComMessage(), messages, peekComMessageType(), perr, sendComMessage(), thread, unlockComMessage(), and yield().

Referenced by destroyMidiDriver().

void LowLevelMidiDriver::extractTimbreLibrary ( XMidiEventList eventlist  )  [private]

Definition at line 1296 of file LowLevelMidiDriver.cpp.

References ConvBaseToActual(), XMidiEventList::events, LowLevelMidiDriver::MT32Timbre::index, msg(), mt32_patch_bank_sel, mt32_patch_banks, mt32_rhythm_bank, mt32_timbre_banks, XMidiEvent::next, patch_base, patch_mem_offset(), LowLevelMidiDriver::MT32Timbre::protect, rhythm_base, rhythm_mem_offset(), LowLevelMidiDriver::MT32Patch::timbre_bank, timbre_base, timbre_mem_offset(), LowLevelMidiDriver::MT32Patch::timbre_num, and LowLevelMidiDriver::MT32Timbre::time_uploaded.

Referenced by loadTimbreLibrary().

void LowLevelMidiDriver::finishSequence ( int  seq_num  )  [virtual]

Finish playing a sequence, and free the data

Parameters:
seq_num The Sequence number to stop

Implements MidiDriver.

Definition at line 279 of file LowLevelMidiDriver.cpp.

References MidiDriver::initialized, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, and uploading_timbres.

uint32 LowLevelMidiDriver::getSequenceCallbackData ( int  seq_num  )  [virtual]

Get the callback data for a specified sequence

Parameters:
seq_num The Sequence to get callback data from

Reimplemented from MidiDriver.

Definition at line 371 of file LowLevelMidiDriver.cpp.

References callback_data, and cbmutex.

uint32 LowLevelMidiDriver::getTickCount ( uint16  sequence_id  )  [private, virtual]

An event sent from a sequence to play

Parameters:
sequence_id The id of the sequence requesting the tick count
Returns:
Number of ticks, in 6000ths of a second

Implements XMidiSequenceHandler.

Definition at line 996 of file LowLevelMidiDriver.cpp.

References xmidi_clock.

void LowLevelMidiDriver::handleCallbackTrigger ( uint16  sequence_id,
uint8  data 
) [private, virtual]

Handle an XMIDI Callback Trigger Event

Parameters:
sequence_id The id of the sequence doing the callback
data data[1] of the XMIDI_CONTROLLER_CALLBACK_TRIG event

Implements XMidiSequenceHandler.

Definition at line 1001 of file LowLevelMidiDriver.cpp.

References callback_data, and cbmutex.

virtual void LowLevelMidiDriver::increaseThreadPriority (  )  [inline, protected, virtual]

Increate the Thread Priority of the Play (current) thread.

Reimplemented in CoreAudioMidiDriver, and WindowsMidiDriver.

Definition at line 95 of file LowLevelMidiDriver.h.

Referenced by threadMain().

int LowLevelMidiDriver::initMidiDriver ( uint32  sample_rate,
bool  stereo 
) [virtual]

Initialize the driver

Parameters:
sample_rate The sample rate for software synths
stereo Specifies if a software synth must produce stero sound
Returns:
Non zero on failure

Implements MidiDriver.

Definition at line 163 of file LowLevelMidiDriver.cpp.

References callback_data, cbmutex, chan_locks, chan_map, cond, destroyMidiDriver(), MidiDriver::initialized, initSoftwareSynth(), initThreadedSynth(), MidiDriver::isSampleProducer(), mt32_bank_sel, mt32_patch_bank_sel, mt32_patch_banks, mt32_rhythm_bank, mt32_timbre_banks, mt32_timbre_used, mutex, next_sysex, perr, playing, sample_rate, sequences, stereo, thread, and uploading_timbres.

int LowLevelMidiDriver::initSoftwareSynth (  )  [private]

Definition at line 600 of file LowLevelMidiDriver.cpp.

References open(), sample_rate, samples_per_iteration, samples_this_second, and total_seconds.

Referenced by initMidiDriver().

int LowLevelMidiDriver::initThreadedSynth (  )  [private]

Definition at line 422 of file LowLevelMidiDriver.cpp.

References lockComMessage(), messages, peekComMessageType(), sendComMessage(), thread, threadMain_Static(), unlockComMessage(), and yield().

Referenced by initMidiDriver().

bool LowLevelMidiDriver::isSequencePlaying ( int  seq_num  )  [virtual]

Check to see if a sequence is playing (doesn't check for pause state)

Parameters:
seq_num The Sequence number to check
Returns:
true is sequence is playing, false if not playing

Implements MidiDriver.

Definition at line 331 of file LowLevelMidiDriver.cpp.

References lockComMessage(), playing, unlockComMessage(), uploading_timbres, and waitTillNoComMessages().

void LowLevelMidiDriver::loadRhythmTemp ( int  temp  )  [private]

Definition at line 1520 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::MT32Timbre::index, PentZip::int(), mt32_rhythm_bank, mt32_timbre_banks, perr, pout, LowLevelMidiDriver::MT32Timbre::protect, rhythm_base, rhythm_mem_offset(), rhythm_mem_size, sendMT32SystemMessage(), LowLevelMidiDriver::MT32Rhythm::timbre, and uploadTimbre().

Referenced by sequenceSendEvent().

void LowLevelMidiDriver::loadTimbreLibrary ( IDataSource ,
TimbreLibraryType  type 
) [virtual]

Reimplemented in FMOplMidiDriver.

Definition at line 1170 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::ComMessage::data, extractTimbreLibrary(), XMidiFile::GetEventList(), loadXMidiTimbreLibrary(), lockComMessage(), mt32_bank_sel, mt32_patch_bank_sel, mt32_patch_banks, mt32_patch_template, mt32_rhythm_bank, mt32_timbre_banks, mt32_timbre_used, LowLevelMidiDriver::ComMessage::play, playing, pout, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, LowLevelMidiDriver::ComMessage::speed, LowLevelMidiDriver::MT32Patch::timbre_bank, MidiDriver::TIMBRE_LIBRARY_SYX_FILE, MidiDriver::TIMBRE_LIBRARY_U7VOICE_MT, MidiDriver::TIMBRE_LIBRARY_XMIDI_FILE, MidiDriver::TIMBRE_LIBRARY_XMIDI_MT, LowLevelMidiDriver::ComMessage::type, unlockComMessage(), uploading_timbres, waitTillNoComMessages(), and yield().

void LowLevelMidiDriver::loadXMidiTimbreLibrary ( IDataSource ds  )  [private]

Definition at line 1621 of file LowLevelMidiDriver.cpp.

References IDataSource::getPos(), IDataSource::getSize(), LowLevelMidiDriver::MT32Timbre::index, mt32_patch_banks, mt32_patch_template, mt32_timbre_banks, pout, LowLevelMidiDriver::MT32Timbre::protect, IDataSource::read(), IDataSource::read1(), IDataSource::read2(), IDataSource::read4(), IDataSource::seek(), LowLevelMidiDriver::MT32Patch::timbre_bank, LowLevelMidiDriver::MT32Patch::timbre_num, and LowLevelMidiDriver::MT32Timbre::time_uploaded.

Referenced by loadTimbreLibrary().

int LowLevelMidiDriver::lockChannel ( uint16  sequence_id,
int  chan,
bool  lock 
) [private]

Definition at line 1052 of file LowLevelMidiDriver.cpp.

References chan_locks, chan_map, XMidiSequence::gainChannel(), XMidiSequence::loseChannel(), and sequences.

Referenced by protectChannel(), sequenceSendEvent(), and unlockAndUnprotectChannel().

void LowLevelMidiDriver::lockComMessage (  )  [private]

Definition at line 408 of file LowLevelMidiDriver.cpp.

References mutex.

Referenced by destroyThreadedSynth(), initThreadedSynth(), isSequencePlaying(), loadTimbreLibrary(), peekComMessageType(), playSequences(), produceSamples(), sendComMessage(), startSequence(), and threadMain().

virtual void LowLevelMidiDriver::lowLevelProduceSamples ( sint16 samples,
uint32  num_samples 
) [inline, protected, virtual]

Allows LowLevelMidiDrivers to produce samples.

Reimplemented in FluidSynthMidiDriver, FMOplMidiDriver, and TimidityMidiDriver.

Definition at line 98 of file LowLevelMidiDriver.h.

Referenced by produceSamples().

int LowLevelMidiDriver::maxSequences (  )  [virtual]

Get the maximum number of playing sequences supported by this this driver

Returns:
The maximum number of playing sequences

Implements MidiDriver.

Definition at line 240 of file LowLevelMidiDriver.cpp.

void LowLevelMidiDriver::muteAllChannels (  )  [private]

Mute all phyisical channels.

virtual int LowLevelMidiDriver::open (  )  [protected, pure virtual]

Open the Midi Device

Returns:
0 on sucess. Non zero on failure.

Implemented in ALSAMidiDriver, CoreAudioMidiDriver, FluidSynthMidiDriver, FMOplMidiDriver, TimidityMidiDriver, UnixSeqMidiDriver, and WindowsMidiDriver.

Referenced by initSoftwareSynth(), and threadMain().

void LowLevelMidiDriver::pauseSequence ( int  seq_num  )  [virtual]

Pause the playback of a sequence

Parameters:
seq_num The Sequence number to pause

Implements MidiDriver.

Definition at line 345 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::ComMessage::data, MidiDriver::initialized, LowLevelMidiDriver::ComMessage::pause, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, and uploading_timbres.

sint32 LowLevelMidiDriver::peekComMessageType (  )  [private]

Definition at line 386 of file LowLevelMidiDriver.cpp.

References lockComMessage(), messages, and unlockComMessage().

Referenced by destroyThreadedSynth(), initThreadedSynth(), playSequences(), and waitTillNoComMessages().

bool LowLevelMidiDriver::playSequences (  )  [private]

Play all sequences, handle communications requests /return true if terminating

Definition at line 700 of file LowLevelMidiDriver.cpp.

References callback_data, XMidiSequence::getChanMask(), global_volume, lockComMessage(), messages, mt32_patch_banks, mt32_timbre_banks, XMidiSequence::pause(), peekComMessageType(), playing, sequences, setPatchBank(), XMidiSequence::setSpeed(), XMidiSequence::setVolume(), unlockAndUnprotectChannel(), unlockComMessage(), XMidiSequence::unpause(), and uploadTimbre().

Referenced by produceSamples(), and threadMain().

void LowLevelMidiDriver::produceSamples ( sint16 samples,
uint32  bytes 
) [virtual]

Produce Samples when doing Software Synthesizing

Parameters:
samples The buffer to fill with samples
bytes The number of bytes of music to produce

Reimplemented from MidiDriver.

Definition at line 646 of file LowLevelMidiDriver.cpp.

References MidiDriver::initialized, lockComMessage(), lowLevelProduceSamples(), messages, playSequences(), sample_rate, samples_per_iteration, samples_this_second, stereo, total_seconds, unlockComMessage(), and xmidi_clock.

int LowLevelMidiDriver::protectChannel ( uint16  sequence_id,
int  chan,
bool  protect 
) [private]

Definition at line 1008 of file LowLevelMidiDriver.cpp.

References chan_locks, chan_map, and lockChannel().

Referenced by sequenceSendEvent(), and unlockAndUnprotectChannel().

virtual void LowLevelMidiDriver::send ( uint32  message  )  [protected, pure virtual]

Send a message to the Midi Device.

Implemented in ALSAMidiDriver, CoreAudioMidiDriver, FluidSynthMidiDriver, FMOplMidiDriver, TimidityMidiDriver, UnixSeqMidiDriver, and WindowsMidiDriver.

Referenced by sequenceSendEvent().

virtual void LowLevelMidiDriver::send_sysex ( uint8  status,
const uint8 msg,
uint16  length 
) [inline, protected, virtual]

Send a SysEX message to the Midi Device.

Reimplemented in ALSAMidiDriver, CoreAudioMidiDriver, UnixSeqMidiDriver, and WindowsMidiDriver.

Definition at line 92 of file LowLevelMidiDriver.h.

Referenced by sendMT32SystemMessage(), and sequenceSendSysEx().

void LowLevelMidiDriver::sendComMessage ( ComMessage message  )  [private]

Definition at line 395 of file LowLevelMidiDriver.cpp.

References cond, lockComMessage(), messages, and unlockComMessage().

Referenced by destroySoftwareSynth(), destroyThreadedSynth(), finishSequence(), initThreadedSynth(), loadTimbreLibrary(), pauseSequence(), setGlobalVolume(), setSequenceSpeed(), setSequenceVolume(), startSequence(), and unpauseSequence().

void LowLevelMidiDriver::sendMT32SystemMessage ( uint32  address_base,
uint16  address_offset,
uint32  len,
const void *  data 
) [private]

Definition at line 1405 of file LowLevelMidiDriver.cpp.

References ConvBaseToActual(), next_sysex, send_sysex(), and sysex_data_start.

Referenced by loadRhythmTemp(), setPatchBank(), threadMain(), and uploadTimbre().

void LowLevelMidiDriver::sequenceSendEvent ( uint16  sequence_id,
uint32  message 
) [private, virtual]

An event sent from a sequence to play

Parameters:
sequence_id The id of the sequence that is attempting to send the event
message The Event being sent

Implements XMidiSequenceHandler.

Definition at line 870 of file LowLevelMidiDriver.cpp.

References chan_map, global_volume, loadRhythmTemp(), lockChannel(), mt32_bank_sel, mt32_patch_bank_sel, mt32_patch_banks, mt32_rhythm_bank, protectChannel(), send(), and setPatchBank().

void LowLevelMidiDriver::sequenceSendSysEx ( uint16  sequence_id,
uint8  status,
const uint8 msg,
uint16  length 
) [private, virtual]

Send a SysEx event from a Sequence

Parameters:
sequence_id The id of the sequence that is attempting to send the event
status The Status Byte of the SysEx event
msg The SysEx data (including terminator byte)
length The number of bytes of SysEx data to send

Implements XMidiSequenceHandler.

Definition at line 929 of file LowLevelMidiDriver.cpp.

References ConvBaseToActual(), next_sysex, patch_base, patch_mem_offset(), patch_temp_base, patch_temp_offset(), rhythm_base, rhythm_mem_offset(), send_sysex(), timbre_base, timbre_mem_offset(), timbre_temp_base, timbre_unk_base, and uploading_timbres.

void LowLevelMidiDriver::setGlobalVolume ( int  vol  )  [virtual]

Set the global volume level

Parameters:
vol The new global volume level (0-255)

Implements MidiDriver.

Definition at line 305 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::ComMessage::data, MidiDriver::initialized, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, and LowLevelMidiDriver::ComMessage::volume.

void LowLevelMidiDriver::setPatchBank ( int  bank,
int  patch 
) [private]

Definition at line 1446 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::MT32Timbre::index, PentZip::int(), mt32_patch_bank_sel, mt32_patch_banks, mt32_patch_template, mt32_timbre_banks, patch_base, patch_mem_offset(), patch_mem_size, perr, pout, sendMT32SystemMessage(), LowLevelMidiDriver::MT32Patch::timbre_bank, LowLevelMidiDriver::MT32Patch::timbre_num, and uploadTimbre().

Referenced by playSequences(), and sequenceSendEvent().

void LowLevelMidiDriver::setSequenceSpeed ( int  seq_num,
int  speed 
) [virtual]

Set the speed of a sequence

Parameters:
seq_num The Sequence number to change it's speed
speed The new speed for the sequence (percentage)

Implements MidiDriver.

Definition at line 317 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::ComMessage::data, MidiDriver::initialized, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, LowLevelMidiDriver::ComMessage::speed, and uploading_timbres.

void LowLevelMidiDriver::setSequenceVolume ( int  seq_num,
int  vol 
) [virtual]

Set the volume of a sequence

Parameters:
seq_num The Sequence number to set the volume for
vol The new volume level for the sequence (0-255)

Implements MidiDriver.

Definition at line 291 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::ComMessage::data, MidiDriver::initialized, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, uploading_timbres, and LowLevelMidiDriver::ComMessage::volume.

void LowLevelMidiDriver::startSequence ( int  seq_num,
XMidiEventList list,
bool  repeat,
int  vol,
int  branch = -1 
) [virtual]

Start playing a sequence

Parameters:
seq_num The Sequence number to use.
list The XMidiEventList to play
repeat If true, endlessly repeat the track
activate If true, set the sequence as active
vol The volume level to start playing the sequence at (0-255)

Implements MidiDriver.

Definition at line 245 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::ComMessage::data, XMidiEventList::incerementCounter(), MidiDriver::initialized, lockComMessage(), LowLevelMidiDriver::ComMessage::play, playing, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, unlockComMessage(), uploading_timbres, waitTillNoComMessages(), and yield().

int LowLevelMidiDriver::threadMain (  )  [private]

Definition at line 495 of file LowLevelMidiDriver.cpp.

References all_dev_reset_base, close(), cond, LowLevelMidiDriver::ComMessage::data, display_base, display_mem_size, increaseThreadPriority(), LowLevelMidiDriver::ComMessage::init_failed, MidiDriver::initialized, lockComMessage(), messages, mutex, open(), playSequences(), sendMT32SystemMessage(), sequences, unlockComMessage(), xmidi_clock, and yield().

Referenced by threadMain_Static().

int LowLevelMidiDriver::threadMain_Static ( void *  data  )  [static, private]

Definition at line 487 of file LowLevelMidiDriver.cpp.

References threadMain().

Referenced by initThreadedSynth().

int LowLevelMidiDriver::unlockAndUnprotectChannel ( uint16  sequence_id  )  [private]

Definition at line 1144 of file LowLevelMidiDriver.cpp.

References chan_map, lockChannel(), and protectChannel().

Referenced by playSequences().

void LowLevelMidiDriver::unlockComMessage (  )  [private]

Definition at line 413 of file LowLevelMidiDriver.cpp.

References mutex.

Referenced by destroyThreadedSynth(), initThreadedSynth(), isSequencePlaying(), loadTimbreLibrary(), peekComMessageType(), playSequences(), produceSamples(), sendComMessage(), startSequence(), and threadMain().

void LowLevelMidiDriver::unpauseSequence ( int  seq_num  )  [virtual]

Unpause the playback of a sequence

Parameters:
seq_num The Sequence number to unpause

Implements MidiDriver.

Definition at line 358 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::ComMessage::data, MidiDriver::initialized, LowLevelMidiDriver::ComMessage::pause, sendComMessage(), LowLevelMidiDriver::ComMessage::sequence, and uploading_timbres.

void LowLevelMidiDriver::uploadTimbre ( int  bank,
int  timbre 
) [private]

Definition at line 1551 of file LowLevelMidiDriver.cpp.

References LowLevelMidiDriver::MT32Timbre::index, mt32_patch_bank_sel, mt32_timbre_banks, mt32_timbre_used, perr, pout, LowLevelMidiDriver::MT32Timbre::protect, sendMT32SystemMessage(), timbre_base, timbre_mem_offset(), timbre_mem_size, LowLevelMidiDriver::MT32Timbre::time_uploaded, and xmidi_clock.

Referenced by loadRhythmTemp(), playSequences(), and setPatchBank().

void LowLevelMidiDriver::waitTillNoComMessages (  )  [private]

Definition at line 403 of file LowLevelMidiDriver.cpp.

References peekComMessageType(), and yield().

Referenced by destroyMidiDriver(), destroySoftwareSynth(), isSequencePlaying(), loadTimbreLibrary(), and startSequence().

virtual void LowLevelMidiDriver::yield (  )  [inline, protected, virtual]

Yield execution of the current thread.

Reimplemented in CoreAudioMidiDriver, and WindowsMidiDriver.

Definition at line 101 of file LowLevelMidiDriver.h.

Referenced by destroyThreadedSynth(), initThreadedSynth(), loadTimbreLibrary(), startSequence(), threadMain(), and waitTillNoComMessages().


Member Data Documentation

sint32 LowLevelMidiDriver::callback_data[LLMD_NUM_SEQ] [private]

Definition at line 169 of file LowLevelMidiDriver.h.

Referenced by getSequenceCallbackData(), handleCallbackTrigger(), initMidiDriver(), and playSequences().

SDL_mutex* LowLevelMidiDriver::cbmutex [private]

Definition at line 159 of file LowLevelMidiDriver.h.

Referenced by destroyMidiDriver(), getSequenceCallbackData(), handleCallbackTrigger(), and initMidiDriver().

int LowLevelMidiDriver::chan_locks[16] [private]

Definition at line 174 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), lockChannel(), and protectChannel().

int LowLevelMidiDriver::chan_map[LLMD_NUM_SEQ][16] [private]

Definition at line 175 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), lockChannel(), protectChannel(), sequenceSendEvent(), and unlockAndUnprotectChannel().

SDL_cond* LowLevelMidiDriver::cond [private]

Definition at line 160 of file LowLevelMidiDriver.h.

Referenced by destroyMidiDriver(), initMidiDriver(), sendComMessage(), and threadMain().

int LowLevelMidiDriver::global_volume [private]

Definition at line 172 of file LowLevelMidiDriver.h.

Referenced by playSequences(), and sequenceSendEvent().

std::queue<ComMessage> LowLevelMidiDriver::messages [private]

Definition at line 157 of file LowLevelMidiDriver.h.

Referenced by destroyThreadedSynth(), initThreadedSynth(), peekComMessageType(), playSequences(), produceSamples(), sendComMessage(), and threadMain().

int LowLevelMidiDriver::mt32_bank_sel[LLMD_NUM_SEQ][16] [private]

Definition at line 217 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), loadTimbreLibrary(), and sequenceSendEvent().

int LowLevelMidiDriver::mt32_patch_bank_sel[128] [private]

Definition at line 218 of file LowLevelMidiDriver.h.

Referenced by extractTimbreLibrary(), initMidiDriver(), loadTimbreLibrary(), sequenceSendEvent(), setPatchBank(), and uploadTimbre().

MT32Patch** LowLevelMidiDriver::mt32_patch_banks[128] [private]

Definition at line 213 of file LowLevelMidiDriver.h.

Referenced by extractTimbreLibrary(), initMidiDriver(), loadTimbreLibrary(), loadXMidiTimbreLibrary(), playSequences(), sequenceSendEvent(), and setPatchBank().

const LowLevelMidiDriver::MT32Patch LowLevelMidiDriver::mt32_patch_template [static, private]

Initial value:

 {
        0,              
        0,              
        24,             
        50,             
        24,             
        0,              
        1,              
        0               
}

Definition at line 204 of file LowLevelMidiDriver.h.

Referenced by loadTimbreLibrary(), loadXMidiTimbreLibrary(), and setPatchBank().

MT32Rhythm* LowLevelMidiDriver::mt32_rhythm_bank[128] [private]

Definition at line 215 of file LowLevelMidiDriver.h.

Referenced by extractTimbreLibrary(), initMidiDriver(), loadRhythmTemp(), loadTimbreLibrary(), and sequenceSendEvent().

MT32Timbre** LowLevelMidiDriver::mt32_timbre_banks[128] [private]

Definition at line 214 of file LowLevelMidiDriver.h.

Referenced by extractTimbreLibrary(), initMidiDriver(), loadRhythmTemp(), loadTimbreLibrary(), loadXMidiTimbreLibrary(), playSequences(), setPatchBank(), and uploadTimbre().

int LowLevelMidiDriver::mt32_timbre_used[64][2] [private]

Definition at line 216 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), loadTimbreLibrary(), and uploadTimbre().

SDL_mutex* LowLevelMidiDriver::mutex [private]

Definition at line 158 of file LowLevelMidiDriver.h.

Referenced by destroyMidiDriver(), initMidiDriver(), lockComMessage(), threadMain(), and unlockComMessage().

int LowLevelMidiDriver::next_sysex [private]

Definition at line 177 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), sendMT32SystemMessage(), and sequenceSendSysEx().

bool LowLevelMidiDriver::playing[LLMD_NUM_SEQ] [private]

Definition at line 168 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), isSequencePlaying(), loadTimbreLibrary(), playSequences(), and startSequence().

uint32 LowLevelMidiDriver::sample_rate [protected]

Definition at line 71 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), initSoftwareSynth(), TimidityMidiDriver::open(), FMOplMidiDriver::open(), FluidSynthMidiDriver::open(), and produceSamples().

uint32 LowLevelMidiDriver::samples_per_iteration [private]

Definition at line 182 of file LowLevelMidiDriver.h.

Referenced by initSoftwareSynth(), and produceSamples().

uint32 LowLevelMidiDriver::samples_this_second [private]

Definition at line 181 of file LowLevelMidiDriver.h.

Referenced by initSoftwareSynth(), and produceSamples().

XMidiSequence* LowLevelMidiDriver::sequences[LLMD_NUM_SEQ] [private]

Definition at line 176 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), lockChannel(), playSequences(), and threadMain().

bool LowLevelMidiDriver::stereo [protected]

Definition at line 72 of file LowLevelMidiDriver.h.

Referenced by initMidiDriver(), FMOplMidiDriver::lowLevelProduceSamples(), TimidityMidiDriver::open(), FluidSynthMidiDriver::open(), and produceSamples().

SDL_Thread* LowLevelMidiDriver::thread [private]

Definition at line 185 of file LowLevelMidiDriver.h.

Referenced by destroyMidiDriver(), destroyThreadedSynth(), initMidiDriver(), initThreadedSynth(), and ~LowLevelMidiDriver().

uint32 LowLevelMidiDriver::total_seconds [private]

Definition at line 180 of file LowLevelMidiDriver.h.

Referenced by initSoftwareSynth(), and produceSamples().

bool LowLevelMidiDriver::uploading_timbres [private]

Definition at line 154 of file LowLevelMidiDriver.h.

Referenced by finishSequence(), initMidiDriver(), isSequencePlaying(), loadTimbreLibrary(), pauseSequence(), sequenceSendSysEx(), setSequenceSpeed(), setSequenceVolume(), startSequence(), and unpauseSequence().

uint32 LowLevelMidiDriver::xmidi_clock [private]

Definition at line 173 of file LowLevelMidiDriver.h.

Referenced by getTickCount(), produceSamples(), threadMain(), and uploadTimbre().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:32 2007 for pentagram by  doxygen 1.4.7