ScummVM API documentation
mididrv_m_mt32.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef NUVIE_SOUND_MIDIDRV_M_MT32_H
23#define NUVIE_SOUND_MIDIDRV_M_MT32_H
24
25#include "audio/mt32gm.h"
26
27namespace Ultima {
28namespace Nuvie {
29
30// An assignment of a MIDI instrument to a MIDI output channel. M data channels
31// using this instrument will be mapped to the specified MIDI channel.
33 int8 midiChannel;
34 uint8 midiInstrument;
35};
36
46protected:
52 struct MChannelData {
53 // The MIDI note currently played on this channel.
54 int8 activeNote = -1;
55 // The MIDI note velocity currently used on this channel.
56 uint8 velocity = 0;
57 // The MIDI note queued for playback on this channel.
58 int8 queuedNote = -1;
59 };
60
61 // Converts M note values to MIDI notes.
62 static const uint8 MIDI_NOTE_MAP[24];
63
64public:
67
69 int open(MidiDriver *driver, bool nativeMT32) override;
70
72 void send(int8 source, uint32 b) override;
73 void metaEvent(int8 source, byte type, const byte *data, uint16 length) override;
74
82
83 void stopAllNotes(bool stopSustainedNotes) override;
84
85protected:
86 void onTimer() override;
87
88 MChannelData _mChannelData[9];
89 // Mapping of M instrument numbers to MIDI output channels
90 int8 _mInstrumentMidiChannels[16];
91 // Mapping of M instrument numbers to MIDI instrument numbers
92 uint8 _mInstrumentMapping[16];
93};
94
95} // End of namespace Nuvie
96} // End of namespace Ultima
97
98#endif
Definition: mt32gm.h:111
void send(uint32 b) override
int open() override
Definition: mididrv.h:313
Definition: mididrv_m_mt32.h:45
void stopAllNotes(bool stopSustainedNotes) override
void setInstrumentAssignments(const MInstrumentAssignment *assignments)
void send(int8 source, uint32 b) override
void metaEvent(int8 source, byte type, const byte *data, uint16 length) override
Definition: mididrv_m_mt32.h:32
Definition: mididrv_m_mt32.h:52