XMidiSequence Class Reference

#include <XMidiSequence.h>

List of all members.

Public Member Functions

 XMidiSequence (XMidiSequenceHandler *handler, uint16 sequence_id, XMidiEventList *events, bool repeat, int volume, int branch)
 ~XMidiSequence ()
int playEvent ()
sint32 timeTillNext ()
void setVolume (int new_vol)
int getVolume ()
void setSpeed (int new_speed)
void loseChannel (int c)
void gainChannel (int c)
void applyShadow (int c)
uint16 getChanMask ()
void pause ()
void unpause ()
bool isPaused ()
int countNotesOn (int chan)

Private Member Functions

void sendEvent ()
void updateShadowForEvent (XMidiEvent *event)
void initClock ()
void addOffset (uint32 offset)
uint32 getTime ()
uint32 getStart ()
uint32 getRealTime ()

Private Attributes

XMidiSequenceHandlerhandler
uint16 sequence_id
XMidiEventListevntlist
XMidiEventevent
bool repeat
XMidiNoteStack notes_on
uint32 last_tick
uint32 start
int loop_num
int vol_multi
bool paused
int speed
XMidiEventloop_event [XMIDI_MAX_FOR_LOOP_COUNT]
int loop_count [XMIDI_MAX_FOR_LOOP_COUNT]
XMidiSequence::ChannelShadow shadows [16]

Classes

struct  ChannelShadow


Detailed Description

Definition at line 27 of file XMidiSequence.h.


Constructor & Destructor Documentation

XMidiSequence::XMidiSequence ( XMidiSequenceHandler handler,
uint16  sequence_id,
XMidiEventList events,
bool  repeat,
int  volume,
int  branch 
)

Create the XXMidiSequence object

Parameters:
handler XMidiSequenceHandler object that the events are to be sent to
sequence_id The id num for this sequence
events The Midi event list that is to be played
repeat Specifies if repeating is enabled or disabled
volume Volume level to play at
branch The Branch index to start playing at

Definition at line 37 of file XMidiSequence.cpp.

References event, XMidiEventList::events, evntlist, XMidiEventList::findBranchEvent(), gainChannel(), handler, initClock(), last_tick, loop_count, loop_event, sequence_id, XMidiSequenceHandler::sequenceSendEvent(), shadows, XMidiEvent::time, and updateShadowForEvent().

XMidiSequence::~XMidiSequence (  ) 

Destructor.

Definition at line 72 of file XMidiSequence.cpp.

References applyShadow(), XMidiEventList::decerementCounter(), evntlist, handler, notes_on, XMidiNoteStack::Pop(), sequence_id, XMidiSequenceHandler::sequenceSendEvent(), and shadows.


Member Function Documentation

void XMidiSequence::addOffset ( uint32  offset  )  [inline, private]

Add an offset to the XMidi clock.

Definition at line 155 of file XMidiSequence.h.

References start.

Referenced by playEvent().

void XMidiSequence::applyShadow ( int  c  ) 

Apply a shadow state

Parameters:
c the channel to apply the shadow for

Definition at line 401 of file XMidiSequence.cpp.

References handler, program, sequence_id, XMidiSequenceHandler::sequenceSendEvent(), shadows, and vol_multi.

Referenced by gainChannel(), unpause(), and ~XMidiSequence().

int XMidiSequence::countNotesOn ( int  chan  ) 

Count the number of notes on for a chan

Parameters:
chan The channel to count for
Returns:
the number of notes on

Definition at line 500 of file XMidiSequence.cpp.

References XMidiEvent::ex, XMidiNoteStack::GetNotes(), XMidiEvent::note_on, notes_on, paused, and XMidiEvent::status.

void XMidiSequence::gainChannel ( int  c  ) 

Called when the XMidiSequenceHandler is giving a channel to this sequence The XMidiSequence will update the state of the channel to what is stored in the shadow

Parameters:
c the channel being gained

Definition at line 470 of file XMidiSequence.cpp.

References applyShadow(), XMidiEvent::data, XMidiEvent::ex, XMidiNoteStack::GetNotes(), handler, XMidiEvent::note_on, notes_on, sequence_id, XMidiSequenceHandler::sequenceSendEvent(), and XMidiEvent::status.

Referenced by LowLevelMidiDriver::lockChannel(), and XMidiSequence().

uint16 XMidiSequence::getChanMask (  )  [inline]

Get the channel used mask

Returns:
the mask of used channels

Definition at line 82 of file XMidiSequence.h.

References XMidiEventList::chan_mask, and evntlist.

Referenced by LowLevelMidiDriver::playSequences().

uint32 XMidiSequence::getRealTime (  )  [inline, private]

Get the real time of the XMidi clock.

Definition at line 167 of file XMidiSequence.h.

References XMidiSequenceHandler::getTickCount(), and handler.

Referenced by playEvent(), and timeTillNext().

uint32 XMidiSequence::getStart (  )  [inline, private]

Get the start time of the XMidi clock.

Definition at line 163 of file XMidiSequence.h.

References start.

Referenced by sendEvent().

uint32 XMidiSequence::getTime (  )  [inline, private]

Get the current time of the XMidi clock.

Definition at line 159 of file XMidiSequence.h.

References XMidiSequenceHandler::getTickCount(), handler, and start.

Referenced by playEvent(), and timeTillNext().

int XMidiSequence::getVolume (  )  [inline]

Get the current volume level

Returns:
the current volume level (0-255)

Definition at line 60 of file XMidiSequence.h.

References vol_multi.

void XMidiSequence::initClock (  )  [inline, private]

Initialize the XMidi clock to begin now.

Definition at line 151 of file XMidiSequence.h.

References XMidiSequenceHandler::getTickCount(), handler, and start.

Referenced by XMidiSequence().

bool XMidiSequence::isPaused (  )  [inline]

Is the sequence paused.

Definition at line 91 of file XMidiSequence.h.

References paused.

void XMidiSequence::loseChannel ( int  c  ) 

Called when the XMidiSequenceHandler is taking a channel from this sequence The XMidiSequence will gracefully reset the state of the channel

Parameters:
c the channel being lost

Definition at line 457 of file XMidiSequence.cpp.

References XMidiEvent::data, XMidiEvent::ex, XMidiNoteStack::GetNotes(), handler, XMidiEvent::note_on, notes_on, sequence_id, XMidiSequenceHandler::sequenceSendEvent(), and XMidiEvent::status.

Referenced by LowLevelMidiDriver::lockChannel(), and pause().

void XMidiSequence::pause (  ) 

Pause the sequence.

Definition at line 484 of file XMidiSequence.cpp.

References XMidiEventList::chan_mask, evntlist, loseChannel(), and paused.

Referenced by LowLevelMidiDriver::playSequences().

int XMidiSequence::playEvent (  ) 

Play a single waiting event

Returns:
<0 if there is no more events

0 if there are pending events that can be played imediately

>0 if there are pending events in the future

Definition at line 135 of file XMidiSequence.cpp.

References addOffset(), XMidiEvent::data, event, XMidiEventList::events, evntlist, XMidiEvent::ex, XMidiEventList::findBranchEvent(), XMidiNoteStack::GetNotes(), getRealTime(), getTime(), XMidiSequenceHandler::handleCallbackTrigger(), handler, last_tick, loop_count, loop_event, loop_num, XMidiEvent::next, notes_on, paused, XMidiNoteStack::PopTime(), repeat, sendEvent(), sequence_id, XMidiSequenceHandler::sequenceSendEvent(), XMidiSequenceHandler::sequenceSendSysEx(), speed, XMidiEvent::status, XMidiEvent::sysex_data, and XMidiEvent::time.

void XMidiSequence::sendEvent (  )  [private]

Send the current event to the XMidiSequenceHandler.

Definition at line 356 of file XMidiSequence.cpp.

References XMidiEvent::data, event, XMidiEvent::ex, getStart(), handler, XMidiEvent::note_on, notes_on, XMidiNoteStack::Push(), XMidiNoteStack::Remove(), sequence_id, XMidiSequenceHandler::sequenceSendEvent(), XMidiNoteStack::SetAftertouch(), speed, XMidiEvent::status, updateShadowForEvent(), and vol_multi.

Referenced by playEvent().

void XMidiSequence::setSpeed ( int  new_speed  )  [inline]

Set the speed of playback

Parameters:
new_speed the new playback speed (percentage)

Definition at line 64 of file XMidiSequence.h.

References speed.

Referenced by LowLevelMidiDriver::playSequences().

void XMidiSequence::setVolume ( int  new_vol  ) 

Set a new volume to use

Parameters:
new_vol the new volume level (0-255)

Definition at line 442 of file XMidiSequence.cpp.

References XMidiEventList::chan_mask, evntlist, handler, sequence_id, XMidiSequenceHandler::sequenceSendEvent(), shadows, vol_multi, and XMidiSequence::ChannelShadow::volumes.

Referenced by LowLevelMidiDriver::playSequences().

sint32 XMidiSequence::timeTillNext (  ) 

Get the time till the next event

Returns:
ms till next event (can be negative if running behind time).

Definition at line 264 of file XMidiSequence.cpp.

References event, XMidiEvent::ex, XMidiNoteStack::GetNotes(), getRealTime(), getTime(), last_tick, XMidiEvent::note_on, notes_on, paused, speed, and XMidiEvent::time.

void XMidiSequence::unpause (  ) 

Unpause the sequence.

Definition at line 492 of file XMidiSequence.cpp.

References applyShadow(), XMidiEventList::chan_mask, evntlist, and paused.

Referenced by LowLevelMidiDriver::playSequences().

void XMidiSequence::updateShadowForEvent ( XMidiEvent event  )  [private]

Update the shadows for an event.

Definition at line 286 of file XMidiSequence.cpp.

References XMidiSequence::ChannelShadow::balance, XMidiSequence::ChannelShadow::bank, XMidiSequence::ChannelShadow::chorus, XMidiEvent::data, XMidiSequence::ChannelShadow::effects, event, XMidiSequence::ChannelShadow::expression, XMidiSequence::ChannelShadow::footpedal, XMidiSequence::ChannelShadow::modWheel, XMidiSequence::ChannelShadow::pan, XMidiSequence::ChannelShadow::pitchWheel, XMidiSequence::ChannelShadow::program, shadows, XMidiEvent::status, XMidiSequence::ChannelShadow::volumes, and XMidiSequence::ChannelShadow::xbank.

Referenced by sendEvent(), and XMidiSequence().


Member Data Documentation

XMidiEvent* XMidiSequence::event [private]

The next event to be played.

Definition at line 103 of file XMidiSequence.h.

Referenced by playEvent(), sendEvent(), timeTillNext(), updateShadowForEvent(), and XMidiSequence().

XMidiEventList* XMidiSequence::evntlist [private]

The Midi event list that is being played.

Definition at line 102 of file XMidiSequence.h.

Referenced by getChanMask(), pause(), playEvent(), setVolume(), unpause(), XMidiSequence(), and ~XMidiSequence().

XMidiSequenceHandler* XMidiSequence::handler [private]

The handler the events are sent to.

Definition at line 100 of file XMidiSequence.h.

Referenced by applyShadow(), gainChannel(), getRealTime(), getTime(), initClock(), loseChannel(), playEvent(), sendEvent(), setVolume(), XMidiSequence(), and ~XMidiSequence().

uint32 XMidiSequence::last_tick [private]

The tick of the previously played notes.

Definition at line 106 of file XMidiSequence.h.

Referenced by playEvent(), timeTillNext(), and XMidiSequence().

int XMidiSequence::loop_count[XMIDI_MAX_FOR_LOOP_COUNT] [private]

The amount of times we have left that we can loop per level.

Definition at line 117 of file XMidiSequence.h.

Referenced by playEvent(), and XMidiSequence().

XMidiEvent* XMidiSequence::loop_event[XMIDI_MAX_FOR_LOOP_COUNT] [private]

The for loop event that triggered the loop per level.

Definition at line 114 of file XMidiSequence.h.

Referenced by playEvent(), and XMidiSequence().

int XMidiSequence::loop_num [private]

The level of the loop we are currently in.

Definition at line 108 of file XMidiSequence.h.

Referenced by playEvent().

XMidiNoteStack XMidiSequence::notes_on [private]

Note stack of notes currently playing, and time to stop.

Definition at line 105 of file XMidiSequence.h.

Referenced by countNotesOn(), gainChannel(), loseChannel(), playEvent(), sendEvent(), timeTillNext(), and ~XMidiSequence().

bool XMidiSequence::paused [private]

Is the sequence paused.

Definition at line 110 of file XMidiSequence.h.

Referenced by countNotesOn(), isPaused(), pause(), playEvent(), timeTillNext(), and unpause().

bool XMidiSequence::repeat [private]

Specifies if repeating is enabled.

Definition at line 104 of file XMidiSequence.h.

Referenced by playEvent().

uint16 XMidiSequence::sequence_id [private]

The sequence id of this sequence.

Definition at line 101 of file XMidiSequence.h.

Referenced by applyShadow(), gainChannel(), loseChannel(), playEvent(), sendEvent(), setVolume(), XMidiSequence(), and ~XMidiSequence().

struct XMidiSequence::ChannelShadow XMidiSequence::shadows[16] [private]

Referenced by applyShadow(), setVolume(), updateShadowForEvent(), XMidiSequence(), and ~XMidiSequence().

int XMidiSequence::speed [private]

Percentage of speed to playback at.

Definition at line 111 of file XMidiSequence.h.

Referenced by playEvent(), sendEvent(), setSpeed(), and timeTillNext().

uint32 XMidiSequence::start [private]

XMidi Clock (in 1/6000 seconds).

Definition at line 107 of file XMidiSequence.h.

Referenced by addOffset(), getStart(), getTime(), and initClock().

int XMidiSequence::vol_multi [private]

Volume multiplier (0-255).

Definition at line 109 of file XMidiSequence.h.

Referenced by applyShadow(), getVolume(), sendEvent(), and setVolume().


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