#include <midiparser_qt.h>
Public Member Functions | |
MidiParser_QT (int8 source=-1) | |
bool | loadMusic (byte *data, uint32 size) override |
void | unloadMusic () override |
bool | loadFromTune (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES) |
bool | loadFromContainerStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES) |
bool | loadFromContainerFile (const Common::Path &fileName) |
Public Member Functions inherited from MidiParser | |
MidiParser (int8 source=-1) | |
virtual void | property (int prop, int value) |
virtual int32 | determineDataSize (Common::SeekableReadStream *stream) |
virtual void | setMidiDriver (MidiDriver_BASE *driver) |
void | setTimerRate (uint32 rate) |
virtual void | setTempo (uint32 tempo) |
virtual void | onTimer () |
bool | isPlaying () const |
bool | startPlaying () |
void | stopPlaying () |
void | pausePlaying () |
void | resumePlaying () |
bool | setTrack (int track) |
bool | jumpToTick (uint32 tick, bool fireEvents=false, bool stopNotes=true, bool dontSendNoteOn=false) |
virtual bool | hasJumpIndex (uint8 index) |
virtual bool | jumpToIndex (uint8 index, bool stopNotes=true) |
uint32 | getPPQN () |
virtual uint32 | getTick () |
Public Member Functions inherited from Common::QuickTimeParser | |
bool | parseFile (const Path &filename) |
bool | parseStream (SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle=DisposeAfterUse::YES) |
void | close () |
void | flattenEditLists () |
void | setChunkBeginOffset (uint32 offset) |
uint32 | getTimeScale () const |
bool | isOpen () const |
Protected Member Functions | |
void | parseNextEvent (EventInfo &info) override |
void | resetTracking () override |
void | sendToDriver (uint32 b) override |
void | sendMetaEventToDriver (byte type, byte *data, uint16 length) override |
SampleDesc * | readSampleDesc (Track *track, uint32 format, uint32 descSize) override |
Protected Member Functions inherited from MidiParser | |
virtual void | allNotesOff () |
virtual bool | processEvent (const EventInfo &info, bool fireEvents=true) |
void | activeNote (byte channel, byte note, bool active) |
void | hangingNote (byte channel, byte note, uint32 ticksLeft, bool recycle=true) |
void | hangAllActiveNotes () |
virtual void | onTrackStart (uint8 track) |
void | sendToDriver (byte status, byte firstOp, byte secondOp) |
uint32 | read4high (byte *&data) |
uint16 | read2low (byte *&data) |
Protected Member Functions inherited from Common::QuickTimeParser | |
void | init () |
Protected Attributes | |
int8 | _source |
Protected Attributes inherited from MidiParser | |
uint16 | _activeNotes [128] |
Each uint16 is a bit mask for channels that have that note on. | |
NoteTimer | _hangingNotes [32] |
Used for "Smart Jump" and MIDI formats that do not include explicit Note Off events. More... | |
byte | _hangingNotesCount |
Count of hanging notes, used to optimize expiration. | |
MidiDriver_BASE * | _driver |
The device to which all events will be transmitted. | |
uint32 | _timerRate |
The time in microseconds between onTimer() calls. Obtained from the MidiDriver. | |
uint32 | _ppqn |
Pulses Per Quarter Note. (We refer to "pulses" as "ticks".) | |
uint32 | _tempo |
Microseconds per quarter note. | |
uint32 | _psecPerTick |
Microseconds per tick (_tempo / _ppqn). | |
uint32 | _sysExDelay |
Number of microseconds until the next SysEx event can be sent. | |
bool | _autoLoop |
For lightweight clients that don't provide their own flow control. | |
bool | _smartJump |
Support smart expiration of hanging notes when jumping. | |
bool | _centerPitchWheelOnUnload |
Center the pitch wheels when unloading a song. | |
bool | _sendSustainOffOnNotesOff |
Send a sustain off on a notes off event, stopping hanging notes. | |
bool | _disableAllNotesOffMidiEvents |
Don't send All Notes Off MIDI messages. | |
bool | _disableAutoStartPlayback |
Do not automatically start playback after parsing MIDI data or setting the track. | |
byte * | _tracks [MAXIMUM_TRACKS] |
Multi-track MIDI formats are supported, up to 120 tracks. | |
byte | _numTracks |
Count of total tracks for multi-track MIDI formats. 1 for single-track formats. | |
byte | _activeTrack |
Keeps track of the currently active track, in multi-track formats. | |
Tracker | _position |
The current time/position in the active track. | |
EventInfo | _nextEvent |
bool | _abortParse |
If a jump or other operation interrupts parsing, flag to abort. | |
bool | _jumpingToTick |
True if currently inside jumpToTick. | |
bool | _doParse |
True if the parser should be parsing; false if it should not be active. | |
bool | _pause |
True if the parser has paused parsing. | |
int8 | _source |
Protected Attributes inherited from Common::QuickTimeParser | |
SeekableReadStream * | _fd |
uint32 | _timeScale |
uint32 | _duration |
Rational | _scaleFactorX |
Rational | _scaleFactorY |
Array< Track * > | _tracks |
Navigation | _nav |
QTVRType | _qtvrType |
uint16 | _winX |
uint16 | _winY |
Track * | _panoTrack |
Additional Inherited Members | |
Public Types inherited from MidiParser | |
enum | { mpAutoLoop = 2, mpSmartJump = 3, mpCenterPitchWheelOnUnload = 4, mpSendSustainOffOnNotesOff = 5, mpDisableAllNotesOffMidiEvents = 6, mpDisableAutoStartPlayback = 7 } |
typedef void(* | XMidiCallbackProc) (byte eventData, void *refCon) |
Public Types inherited from Common::QuickTimeParser | |
enum | QTVRType { OTHER, OBJECT, PANORAMA } |
Static Public Member Functions inherited from MidiParser | |
static void | defaultXMidiCallback (byte eventData, void *refCon) |
static MidiParser * | createParser_SMF (int8 source=-1) |
static MidiParser * | createParser_XMIDI (XMidiCallbackProc proc=defaultXMidiCallback, void *refCon=0, int source=-1) |
static MidiParser * | createParser_QT (int8 source=-1) |
static void | timerCallback (void *data) |
Protected Types inherited from Common::QuickTimeParser | |
enum | CodecType { CODEC_TYPE_MOV_OTHER, CODEC_TYPE_VIDEO, CODEC_TYPE_AUDIO, CODEC_TYPE_MIDI, CODEC_TYPE_PANO } |
enum | GraphicsMode { COPY = 0x0, DITHER_COPY = 0x40, BLEND = 0x20, TRANSPARENT = 0x24, STRAIGHT_ALPHA = 0x100, PREMUL_WHITE_ALPHA = 0x101, PREMUL_BLACK_ALPHA = 0x102, STRAIGHT_ALPHA_BLEND = 0x104, COMPOSITION = 0x103 } |
enum | HotSpotType { undefined, link, navg } |
enum | MovieType { kStandardObject = 1, kOldNavigableMovieScene, kObjectInScene } |
Static Protected Member Functions inherited from MidiParser | |
static uint32 | readVLQ (byte *&data) |
Static Protected Attributes inherited from MidiParser | |
static const uint8 | MAXIMUM_TRACKS = 120 |
The QuickTime Music version of MidiParser.
QuickTime Music is actually a superset of MIDI. It has its own custom instruments and supports more than 15 non-percussion channels. It also has custom control changes and a more advanced pitch bend (which we convert to GM pitch bend as best as possible). We then use the fallback GM instrument that each QuickTime instrument definition has to provide.
Furthermore, Apple's documentation on this is terrible. You know documentation is bad when it contradicts itself three times on the same subject (like about setting the GM instrument field to percussion).
This is as close to a proper QuickTime Music parser as we can currently implement using our MidiParser interface.
bool MidiParser_QT::loadFromTune | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES |
||
) |
Load the MIDI from a 'Tune' resource
bool MidiParser_QT::loadFromContainerStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES |
||
) |
Load the MIDI from a QuickTime stream
bool MidiParser_QT::loadFromContainerFile | ( | const Common::Path & | fileName | ) |
Load the MIDI from a QuickTime file
|
protected |
The source number to use when sending MIDI messages to the driver. When using multiple sources, use source 0 and higher. This must be used when source volume or channel locking is used. By default this is -1, which means the parser is the only source of MIDI messages and multiple source functionality is disabled.