aboutsummaryrefslogtreecommitdiff
path: root/audio/midiparser_qt.h
diff options
context:
space:
mode:
authorMatthew Hoops2012-09-12 13:22:33 -0400
committerMatthew Hoops2012-09-12 14:36:17 -0400
commitbb45b24f8877865e47f793d254371728aa399849 (patch)
tree9920323de7eaf195bc950882a593f836185a24af /audio/midiparser_qt.h
parentc023651cb37752a7dd5e53a7bb27f20dbc9fd41e (diff)
downloadscummvm-rg350-bb45b24f8877865e47f793d254371728aa399849.tar.gz
scummvm-rg350-bb45b24f8877865e47f793d254371728aa399849.tar.bz2
scummvm-rg350-bb45b24f8877865e47f793d254371728aa399849.zip
AUDIO: Implement simple dynamic QuickTime MIDI channel remapping
Needed for IHNM Mac sounds
Diffstat (limited to 'audio/midiparser_qt.h')
-rw-r--r--audio/midiparser_qt.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/audio/midiparser_qt.h b/audio/midiparser_qt.h
index 25c2ae99fb..c2403f31c5 100644
--- a/audio/midiparser_qt.h
+++ b/audio/midiparser_qt.h
@@ -26,6 +26,7 @@
#include "audio/midiparser.h"
#include "common/array.h"
#include "common/hashmap.h"
+#include "common/queue.h"
#include "common/quicktime.h"
/**
@@ -70,6 +71,13 @@ private:
uint32 timeScale;
};
+ struct PartStatus {
+ uint32 instrument;
+ byte volume;
+ byte pan;
+ uint16 pitchBend;
+ };
+
class MIDISampleDesc : public SampleDesc {
public:
MIDISampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag);
@@ -79,18 +87,30 @@ private:
uint32 _requestSize;
};
- uint32 readNextEvent(EventInfo &info);
- void handleGeneralEvent(EventInfo &info, uint32 control);
+ uint32 readNextEvent();
+ void handleGeneralEvent(uint32 control);
+ void handleControllerEvent(uint32 control, uint32 part, byte intPart, byte fracPart);
+ void handleNoteEvent(uint32 part, byte pitch, byte velocity, uint32 length);
- void allocateChannel(uint32 part, uint32 instrument);
- byte getChannel(uint32 part) const;
+ void definePart(uint32 part, uint32 instrument);
+ void setupPart(uint32 part);
+
+ byte getChannel(uint32 part);
bool isChannelAllocated(byte channel) const;
+ byte findFreeChannel(uint32 part);
+ void deallocateFreeChannel();
+ void deallocateChannel(byte channel);
+ bool allChannelsAllocated() const;
byte *readWholeTrack(Common::QuickTimeParser::Track *track, uint32 &trackSize);
Common::Array<MIDITrackInfo> _trackInfo;
+ Common::Queue<EventInfo> _queuedEvents;
+
+ typedef Common::HashMap<uint, PartStatus> PartMap;
+ PartMap _partMap;
- typedef Common::HashMap<uint, uint> ChannelMap;
+ typedef Common::HashMap<uint, byte> ChannelMap;
ChannelMap _channelMap;
void initFromContainerTracks();