ScummVM API documentation
sound_driver_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 MM_SHARED_XEEN_SOUND_DRIVER_MT32_H
23#define MM_SHARED_XEEN_SOUND_DRIVER_MT32_H
24
25
26#include "audio/mididrv.h"
27#include "mm/shared/xeen/sound_driver.h"
28
29namespace MM {
30namespace Shared {
31namespace Xeen {
32
34 struct MidiValue {
35 uint32 _val;
36
37 MidiValue(uint8 command, uint8 op1, uint8 op2) {
38 _val = (command) | ((uint32)op2 << 16) | ((uint32)op1 << 8);
39 }
40 };
41public:
42 MidiDriver *_midiDriver;
43 uint32 _timerCount;
44private:
45 static const uint8 MIDI_NOTE_MAP[24];
46private:
48 Common::Mutex _driverMutex;
49 const byte *_musInstrumentPtrs[16];
50 const byte *_fxInstrumentPtrs[16];
51 byte _last_notes[16];
52 int _field180;
53 int _field181;
54 int _field182;
55 int _musicVolume, _sfxVolume;
56private:
60 void initialize();
61
66 void write(uint8 command, uint8 op1, uint8 op2);
67
71 void flush();
72
76 void resetFrequencies();
77
81 void playInstrument(byte channelNum, const byte *data, bool isFx);
82
86 byte calculateLevel(byte level, bool isFx);
87
91 byte noteMap(byte note);
92protected:
93 bool musSetInstrument(const byte *&srcP, byte param) override;
94 bool musSetPitchWheel(const byte *&srcP, byte param) override;
95 bool musSetPanning(const byte *&srcP, byte param) override;
96 bool musFade(const byte *&srcP, byte param) override;
97 bool musStartNote(const byte *&srcP, byte param) override;
98 bool musSetVolume(const byte *&srcP, byte param) override;
99 bool musInjectMidi(const byte *&srcP, byte param) override;
100 bool musPlayInstrument(const byte *&srcP, byte param) override;
101 bool cmdFreezeFrequency(const byte *&srcP, byte param) override;
102 bool cmdChangeFrequency(const byte *&srcP, byte param) override;
103
104 bool fxSetInstrument(const byte *&srcP, byte param) override;
105 bool fxSetVolume(const byte *&srcP, byte param) override;
106 bool fxMidiReset(const byte *&srcP, byte param) override;
107 bool fxMidiDword(const byte *&srcP, byte param) override;
108 bool fxSetPanning(const byte *&srcP, byte param) override;
109 bool fxChannelOff(const byte *&srcP, byte param) override;
110 bool fxFade(const byte *&srcP, byte param) override;
111 bool fxStartNote(const byte *&srcP, byte param) override;
112 bool fxInjectMidi(const byte *&srcP, byte param) override;
113 bool fxPlayInstrument(const byte *&srcP, byte param) override;
114
118 void pausePostProcess() override;
119
123 void resetFX() override;
124
128 void sysExMessage(const byte *&data) override;
129public:
134
139
143 void playFX(uint effectId, const byte *data) override;
144
148 void playSong(const byte *data) override;
149
153 int songCommand(uint commandId, byte musicVolume = 0, byte sfxVolume = 0) override;
154
158 void onTimer();
159};
160
161} // namespace Xeen
162} // namespace Shared
163} // namespace MM
164
165#endif
Definition: mutex.h:67
Definition: sound_driver.h:56
Definition: sound_driver_mt32.h:33
void sysExMessage(const byte *&data) override
void playFX(uint effectId, const byte *data) override
int songCommand(uint commandId, byte musicVolume=0, byte sfxVolume=0) override
void playSong(const byte *data) override
Definition: mididrv.h:313
Definition: detection.h:27