22 #ifndef MM_SHARED_XEEN_SOUND_DRIVER_H 23 #define MM_SHARED_XEEN_SOUND_DRIVER_H 25 #include "audio/fmopl.h" 26 #include "audio/mixer.h" 27 #include "common/array.h" 28 #include "common/mutex.h" 29 #include "common/queue.h" 30 #include "common/stack.h" 31 #include "mm/shared/xeen/file.h" 33 #define CHANNEL_COUNT 9 35 #define CALLBACKS_PER_SECOND 72.8f 46 STOP_SONG = 0, RESTART_SONG = 1, SET_VOLUME = 0x100, GET_STATUS = 0xFFE0
51 typedef bool (SoundDriver:: *CommandFn)(
const byte *&srcP, byte param);
61 Subroutine() : _returnP(
nullptr), _jumpP(
nullptr) {
63 Subroutine(
const byte *returnP,
const byte *endP) :
64 _returnP(returnP), _jumpP(endP) {
68 bool _changeFrequency;
76 Channel() : _changeFrequency(
false), _freqCtr(0), _freqCtrChange(0),
77 _freqChange(0), _volume(0), _totalLevel(0), _frequency(0), _isFx(
false) {
90 Stream(
const CommandFn *commands) : _playing(
false), _countdownTimer(0), _dataPtr(
nullptr), _startPtr(
nullptr), _commands(commands) {
96 const byte *_startPtr;
97 const CommandFn *_commands;
101 static const CommandFn FX_COMMANDS[16];
102 static const CommandFn MUSIC_COMMANDS[16];
112 bool command(
const byte *&srcP);
126 virtual bool musCallSubroutine(
const byte *&srcP, byte param);
127 virtual bool musSetCountdown(
const byte *&srcP, byte param);
128 virtual bool musSetInstrument(
const byte *&srcP, byte param) = 0;
129 virtual bool cmdNoOperation(
const byte *&srcP, byte param);
130 virtual bool musSetPitchWheel(
const byte *&srcP, byte param) = 0;
131 virtual bool musSkipWord(
const byte *&srcP, byte param);
132 virtual bool musSetPanning(
const byte *&srcP, byte param) = 0;
133 virtual bool musFade(
const byte *&srcP, byte param) = 0;
134 virtual bool musStartNote(
const byte *&srcP, byte param) = 0;
135 virtual bool musSetVolume(
const byte *&srcP, byte param) = 0;
136 virtual bool musInjectMidi(
const byte *&srcP, byte param) = 0;
137 virtual bool musPlayInstrument(
const byte *&srcP, byte param) = 0;
138 virtual bool cmdFreezeFrequency(
const byte *&srcP, byte param) = 0;
139 virtual bool cmdChangeFrequency(
const byte *&srcP, byte param) = 0;
140 virtual bool musEndSubroutine(
const byte *&srcP, byte param);
143 virtual bool fxCallSubroutine(
const byte *&srcP, byte param);
144 virtual bool fxSetCountdown(
const byte *&srcP, byte param);
145 virtual bool fxSetInstrument(
const byte *&srcP, byte param) = 0;
146 virtual bool fxSetVolume(
const byte *&srcP, byte param) = 0;
147 virtual bool fxMidiReset(
const byte *&srcP, byte param) = 0;
148 virtual bool fxMidiDword(
const byte *&srcP, byte param) = 0;
149 virtual bool fxSetPanning(
const byte *&srcP, byte param) = 0;
150 virtual bool fxChannelOff(
const byte *&srcP, byte param) = 0;
151 virtual bool fxFade(
const byte *&srcP, byte param) = 0;
152 virtual bool fxStartNote(
const byte *&srcP, byte param) = 0;
153 virtual bool fxInjectMidi(
const byte *&srcP, byte param) = 0;
154 virtual bool fxPlayInstrument(
const byte *&srcP, byte param) = 0;
155 virtual bool fxEndSubroutine(
const byte *&srcP, byte param);
160 virtual void pausePostProcess() = 0;
165 virtual void resetFX() = 0;
180 virtual void playFX(uint effectId,
const byte *data);
185 void stopFX(
bool force =
false);
190 virtual void playSong(
const byte *data);
195 virtual int songCommand(uint commandId, byte musicVolume = 0, byte sfxVolume = 0);
201 return _streams[stMUSIC]._playing;
207 virtual void sysExMessage(
const byte *&data) = 0;
Definition: sound_driver.h:58
Definition: sound_driver.h:67
Definition: detection.h:27
Definition: sound_driver.h:86
bool isPlaying() const
Definition: sound_driver.h:200
Definition: sound_driver.h:56