aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/sound_midi.cpp8
-rw-r--r--engines/agi/sound_midi.h16
-rw-r--r--engines/agos/agos.cpp2
-rw-r--r--engines/agos/midi.cpp4
-rw-r--r--engines/agos/midi.h11
-rw-r--r--engines/draci/music.cpp6
-rw-r--r--engines/draci/music.h10
-rw-r--r--engines/groovie/music.cpp36
-rw-r--r--engines/groovie/music.h8
-rw-r--r--engines/hugo/sound.cpp16
-rw-r--r--engines/hugo/sound.h8
-rw-r--r--engines/kyra/sound_intern.h8
-rw-r--r--engines/kyra/sound_midi.cpp18
-rw-r--r--engines/lure/sound.cpp4
-rw-r--r--engines/lure/sound.h10
-rw-r--r--engines/m4/midi.cpp7
-rw-r--r--engines/m4/midi.h10
-rw-r--r--engines/made/music.cpp8
-rw-r--r--engines/made/music.h10
-rw-r--r--engines/parallaction/sound_br.cpp11
-rw-r--r--engines/parallaction/sound_ns.cpp11
-rw-r--r--engines/queen/music.h13
-rw-r--r--engines/saga/music.cpp4
-rw-r--r--engines/saga/music.h8
-rw-r--r--engines/sci/sound/drivers/cms.cpp2
-rw-r--r--engines/sci/sound/drivers/fb01.cpp2
-rw-r--r--engines/sci/sound/drivers/midi.cpp2
-rw-r--r--engines/sci/sound/drivers/mididriver.h7
-rw-r--r--engines/scumm/imuse/imuse_internal.h10
-rw-r--r--engines/scumm/imuse/imuse_player.cpp4
-rw-r--r--engines/testbed/midi.cpp2
-rw-r--r--engines/tinsel/music.cpp4
-rw-r--r--engines/tinsel/music.h9
-rw-r--r--engines/touche/midi.cpp4
-rw-r--r--engines/touche/midi.h7
35 files changed, 45 insertions, 255 deletions
diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp
index 050c0d6e2c..877f6326fa 100644
--- a/engines/agi/sound_midi.cpp
+++ b/engines/agi/sound_midi.cpp
@@ -72,7 +72,7 @@ MIDISound::MIDISound(uint8 *data, uint32 len, int resnum, SoundMgr &manager) : A
}
SoundGenMIDI::SoundGenMIDI(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer), _parser(0), _isPlaying(false), _passThrough(false), _isGM(false) {
- DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
+ MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
_driver = MidiDriver::createMidi(dev);
if (ConfMan.getBool("native_mt32") || MidiDriver::getMusicType(dev) == MT_MT32) {
@@ -138,10 +138,6 @@ int SoundGenMIDI::open() {
return 0;
}
-bool SoundGenMIDI::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void SoundGenMIDI::close() {
stop();
if (_driver)
@@ -221,7 +217,7 @@ void SoundGenMIDI::play(int resnum) {
MidiParser *parser = _smfParser;
parser->setTrack(0);
parser->setMidiDriver(this);
- parser->setTimerRate(getBaseTempo());
+ parser->setTimerRate(_driver->getBaseTempo());
parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
_parser = parser;
diff --git a/engines/agi/sound_midi.h b/engines/agi/sound_midi.h
index b7355a0d5d..2e1bfe2c8a 100644
--- a/engines/agi/sound_midi.h
+++ b/engines/agi/sound_midi.h
@@ -46,7 +46,7 @@ protected:
uint16 _type; ///< Sound resource type
};
-class SoundGenMIDI : public SoundGen, public MidiDriver {
+class SoundGenMIDI : public SoundGen, public MidiDriver_BASE {
public:
SoundGenMIDI(AgiEngine *vm, Audio::Mixer *pMixer);
~SoundGenMIDI();
@@ -72,27 +72,19 @@ public:
// MidiDriver interface implementation
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
-
- // Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
- MidiParser *_parser;
- Common::Mutex _mutex;
-
private:
static void onTimer(void *data);
void setChannelVolume(int channel);
+ MidiParser *_parser;
+ Common::Mutex _mutex;
+
MidiChannel *_channel[16];
MidiDriver *_driver;
MidiParser *_smfParser;
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 574031d047..7b6d4cf3e3 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -571,7 +571,7 @@ Common::Error AGOSEngine::init() {
int ret = _midi.open();
if (ret)
- warning("MIDI Player init failed: \"%s\"", _midi.getErrorName (ret));
+ warning("MIDI Player init failed: \"%s\"", MidiDriver::getErrorName (ret));
_midi.setVolume(ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"));
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index bbc0181b11..d76aa42ddc 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -84,10 +84,6 @@ int MidiPlayer::open() {
return 0;
}
-bool MidiPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MidiPlayer::close() {
stop();
// _system->lockMutex(_mutex);
diff --git a/engines/agos/midi.h b/engines/agos/midi.h
index c27c5a7973..01456d784e 100644
--- a/engines/agos/midi.h
+++ b/engines/agos/midi.h
@@ -55,7 +55,7 @@ struct MusicInfo {
}
};
-class MidiPlayer : public MidiDriver {
+class MidiPlayer : public MidiDriver_BASE {
protected:
Common::Mutex _mutex;
MidiDriver *_driver;
@@ -115,20 +115,11 @@ public:
public:
// MidiDriver interface implementation
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
void setPassThrough(bool b) { _passThrough = b; }
-
- // Timing functions - MidiDriver now operates timers
- void setTimerCallback(void *timer_param, void (*timer_proc) (void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
-
- // Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
};
} // End of namespace AGOS
diff --git a/engines/draci/music.cpp b/engines/draci/music.cpp
index cc1cd6d3fb..b56e10518b 100644
--- a/engines/draci/music.cpp
+++ b/engines/draci/music.cpp
@@ -97,10 +97,6 @@ int MusicPlayer::open() {
return 0;
}
-bool MusicPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MusicPlayer::close() {
stop();
if (_driver) {
@@ -198,7 +194,7 @@ void MusicPlayer::playSMF(int track, bool loop) {
MidiParser *parser = _smfParser;
parser->setTrack(0);
parser->setMidiDriver(this);
- parser->setTimerRate(getBaseTempo());
+ parser->setTimerRate(_driver->getBaseTempo());
parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
_parser = parser;
diff --git a/engines/draci/music.h b/engines/draci/music.h
index 0d15fdaf1b..80d25016dc 100644
--- a/engines/draci/music.h
+++ b/engines/draci/music.h
@@ -36,7 +36,7 @@ namespace Draci {
// Taken from MADE, which took it from SAGA.
-class MusicPlayer : public MidiDriver {
+class MusicPlayer : public MidiDriver_BASE {
public:
MusicPlayer(MidiDriver *driver, const char *pathMask);
~MusicPlayer();
@@ -61,19 +61,11 @@ public:
// MidiDriver interface implementation
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
-
- //Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
MidiParser *_parser;
Common::Mutex _mutex;
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index 7651576828..1921d65b41 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -264,12 +264,6 @@ int MusicPlayerMidi::open() {
return 0;
}
-bool MusicPlayerMidi::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
-void MusicPlayerMidi::close() {}
-
void MusicPlayerMidi::send(uint32 b) {
if ((b & 0xFFF0) == 0x07B0) { // Volume change
// Save the specific channel volume
@@ -298,32 +292,6 @@ void MusicPlayerMidi::metaEvent(byte type, byte *data, uint16 length) {
}
}
-void MusicPlayerMidi::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
- if (_driver)
- _driver->setTimerCallback(timer_param, timer_proc);
-}
-
-uint32 MusicPlayerMidi::getBaseTempo() {
- if (_driver)
- return _driver->getBaseTempo();
- else
- return 0;
-}
-
-MidiChannel *MusicPlayerMidi::allocateChannel() {
- if (_driver)
- return _driver->allocateChannel();
- else
- return 0;
-}
-
-MidiChannel *MusicPlayerMidi::getPercussionChannel() {
- if (_driver)
- return _driver->getPercussionChannel();
- else
- return 0;
-}
-
void MusicPlayerMidi::updateChanVolume(byte channel) {
// Generate a MIDI Control change message for the volume
uint32 b = 0x7B0;
@@ -406,7 +374,7 @@ MusicPlayerXMI::MusicPlayerXMI(GroovieEngine *vm, const Common::String &gtlName)
// Create the driver
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
- _driver = createMidi(dev);
+ _driver = MidiDriver::createMidi(dev);
this->open();
// Set the parser's driver
@@ -706,7 +674,7 @@ MusicPlayerMac::MusicPlayerMac(GroovieEngine *vm) : MusicPlayerMidi(vm) {
// Create the driver
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
- _driver = createMidi(dev);
+ _driver = MidiDriver::createMidi(dev);
this->open();
// Set the parser's driver
diff --git a/engines/groovie/music.h b/engines/groovie/music.h
index e45e130a70..870fd10b06 100644
--- a/engines/groovie/music.h
+++ b/engines/groovie/music.h
@@ -88,21 +88,15 @@ protected:
virtual void unload();
};
-class MusicPlayerMidi : public MusicPlayer, public MidiDriver {
+class MusicPlayerMidi : public MusicPlayer, public MidiDriver_BASE {
public:
MusicPlayerMidi(GroovieEngine *vm);
~MusicPlayerMidi();
// MidiDriver interface
virtual int open();
- virtual bool isOpen() const;
- virtual void close();
virtual void send(uint32 b);
virtual void metaEvent(byte type, byte *data, uint16 length);
- virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
- virtual uint32 getBaseTempo();
- virtual MidiChannel *allocateChannel();
- virtual MidiChannel *getPercussionChannel();
private:
// Channel volumes
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 33627fb240..daa467f517 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -75,18 +75,6 @@ void MidiPlayer::setLooping(bool loop) {
_isLooping = loop;
}
-MidiChannel *MidiPlayer::allocateChannel() {
- return 0;
-}
-
-MidiChannel *MidiPlayer::getPercussionChannel() {
- return 0;
-}
-
-uint32 MidiPlayer::getBaseTempo() {
- return _driver ? _driver->getBaseTempo() : 0;
-}
-
void MidiPlayer::play(uint8 *stream, uint16 size) {
debugC(3, kDebugMusic, "MidiPlayer::play");
if (!stream) {
@@ -191,10 +179,6 @@ int MidiPlayer::open() {
return 0;
}
-bool MidiPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MidiPlayer::close() {
stop();
diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h
index e5e9d94ebb..c8f4ae50da 100644
--- a/engines/hugo/sound.h
+++ b/engines/hugo/sound.h
@@ -40,7 +40,7 @@
namespace Hugo {
-class MidiPlayer : public MidiDriver {
+class MidiPlayer : public MidiDriver_BASE {
public:
MidiPlayer(MidiDriver *driver);
~MidiPlayer();
@@ -60,15 +60,9 @@ public:
// MidiDriver interface
int open();
- bool isOpen() const;
-
- MidiChannel *allocateChannel();
- MidiChannel *getPercussionChannel();
-
void close();
void metaEvent(byte type, byte *data, uint16 length);
void send(uint32 b);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
uint32 getBaseTempo();
diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h
index 7b33fc218c..354f5732bf 100644
--- a/engines/kyra/sound_intern.h
+++ b/engines/kyra/sound_intern.h
@@ -219,12 +219,12 @@ public:
~MidiDriver_PCSpeaker();
// MidiDriver interface
- void close() {}
+ virtual void close() {}
- void send(uint32 data);
+ virtual void send(uint32 data);
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
+ virtual MidiChannel *allocateChannel() { return 0; }
+ virtual MidiChannel *getPercussionChannel() { return 0; }
// MidiDriver_Emulated interface
void generateSamples(int16 *buffer, int numSamples);
diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp
index 903375c362..02ba735a70 100644
--- a/engines/kyra/sound_midi.cpp
+++ b/engines/kyra/sound_midi.cpp
@@ -33,7 +33,7 @@
namespace Kyra {
-class MidiOutput : public MidiDriver {
+class MidiOutput : public MidiDriver_BASE {
public:
MidiOutput(OSystem *system, MidiDriver *output, bool isMT32, bool defaultMT32);
~MidiOutput();
@@ -46,20 +46,16 @@ public:
void setSoundSource(int source) { _curSource = source; }
- void send(uint32 b);
- void sysEx(const byte *msg, uint16 length);
- void metaEvent(byte type, byte *data, uint16 length);
+ // MidiDriver_BASE interface
+ virtual void send(uint32 b);
+ virtual void sysEx(const byte *msg, uint16 length);
+ virtual void metaEvent(byte type, byte *data, uint16 length);
+ // TODO: Get rid of the following two methods
void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { _output->setTimerCallback(timerParam, timerProc); }
uint32 getBaseTempo() { return _output->getBaseTempo(); }
- // DUMMY
- int open() { return 0; }
- bool isOpen() const { return true; }
- void close() {}
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
private:
void sendIntern(const byte event, const byte channel, byte param1, const byte param2);
void sendSysEx(const byte p1, const byte p2, const byte p3, const byte *buffer, const int size);
@@ -266,7 +262,7 @@ void MidiOutput::sendIntern(const byte event, const byte channel, byte param1, c
if (event == 0xC0) {
// MT32 -> GM conversion
if (!_isMT32 && _defaultMT32)
- param1 = _mt32ToGm[param1];
+ param1 = MidiDriver::_mt32ToGm[param1];
}
_output->send(event | channel, param1, param2);
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 482527da13..5f954eb337 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -694,10 +694,6 @@ int MidiMusic::open() {
return 0;
}
-bool MidiMusic::isOpen() const {
- return _driver != 0;
-}
-
void MidiMusic::close() {
}
diff --git a/engines/lure/sound.h b/engines/lure/sound.h
index 454bff26f4..f4ddb8de79 100644
--- a/engines/lure/sound.h
+++ b/engines/lure/sound.h
@@ -46,7 +46,7 @@ struct ChannelEntry {
uint8 volume;
};
-class MidiMusic: public MidiDriver {
+class MidiMusic: public MidiDriver_BASE {
private:
uint8 _soundNumber;
uint8 _channelNumber;
@@ -86,20 +86,12 @@ public:
//MidiDriver interface implementation
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void onTimer();
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
-
- //Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
uint8 channelNumber() { return _channelNumber; }
uint8 soundNumber() { return _soundNumber; }
bool isPlaying() { return _isPlaying; }
diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp
index 3a6475da89..36f7f29a2e 100644
--- a/engines/m4/midi.cpp
+++ b/engines/m4/midi.cpp
@@ -33,11 +33,12 @@
namespace M4 {
MidiPlayer::MidiPlayer(MadsM4Engine *vm, MidiDriver *driver) : _vm(vm), _midiData(NULL), _driver(driver), _isPlaying(false), _passThrough(false), _isGM(false) {
+ assert(_driver);
memset(_channel, 0, sizeof(_channel));
_masterVolume = 0;
_parser = MidiParser::createParser_SMF();
_parser->setMidiDriver(this);
- _parser->setTimerRate(getBaseTempo());
+ _parser->setTimerRate(_driver->getBaseTempo());
open();
}
@@ -83,10 +84,6 @@ int MidiPlayer::open() {
return 0;
}
-bool MidiPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MidiPlayer::close() {
stopMusic();
if (_driver) {
diff --git a/engines/m4/midi.h b/engines/m4/midi.h
index a631cec2cb..46dc5efd27 100644
--- a/engines/m4/midi.h
+++ b/engines/m4/midi.h
@@ -34,7 +34,7 @@
namespace M4 {
-class MidiPlayer : public MidiDriver {
+class MidiPlayer : public MidiDriver_BASE {
public:
MidiPlayer(MadsM4Engine *vm, MidiDriver *driver);
~MidiPlayer();
@@ -54,19 +54,11 @@ public:
//MidiDriver interface implementation
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
-
- //Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
protected:
static void onTimer(void *data);
diff --git a/engines/made/music.cpp b/engines/made/music.cpp
index 5ace99788b..acb37bc951 100644
--- a/engines/made/music.cpp
+++ b/engines/made/music.cpp
@@ -89,10 +89,6 @@ int MusicPlayer::open() {
return 0;
}
-bool MusicPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MusicPlayer::close() {
stop();
if (_driver) {
@@ -169,7 +165,7 @@ void MusicPlayer::playXMIDI(GenericResource *midiResource, MusicFlags flags) {
MidiParser *parser = _xmidiParser;
parser->setTrack(0);
parser->setMidiDriver(this);
- parser->setTimerRate(getBaseTempo());
+ parser->setTimerRate(_driver->getBaseTempo());
parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
parser->property(MidiParser::mpSendSustainOffOnNotesOff, 1);
@@ -196,7 +192,7 @@ void MusicPlayer::playSMF(GenericResource *midiResource, MusicFlags flags) {
MidiParser *parser = _smfParser;
parser->setTrack(0);
parser->setMidiDriver(this);
- parser->setTimerRate(getBaseTempo());
+ parser->setTimerRate(_driver->getBaseTempo());
parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
_parser = parser;
diff --git a/engines/made/music.h b/engines/made/music.h
index 024588ea4d..6bd4da470e 100644
--- a/engines/made/music.h
+++ b/engines/made/music.h
@@ -41,7 +41,7 @@ enum MusicFlags {
MUSIC_LOOP = 1
};
-class MusicPlayer : public MidiDriver {
+class MusicPlayer : public MidiDriver_BASE {
public:
MusicPlayer(MidiDriver *driver);
~MusicPlayer();
@@ -66,19 +66,11 @@ public:
//MidiDriver interface implementation
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
-
- //Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
MidiParser *_parser;
Common::Mutex _mutex;
diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp
index 80bd95779d..b74a584b2c 100644
--- a/engines/parallaction/sound_br.cpp
+++ b/engines/parallaction/sound_br.cpp
@@ -201,7 +201,7 @@ MidiParser *createParser_MSC() {
}
-class MidiPlayer_MSC : public MidiDriver {
+class MidiPlayer_MSC : public MidiDriver_BASE {
public:
enum {
@@ -222,14 +222,9 @@ public:
// MidiDriver interface
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
private:
@@ -342,10 +337,6 @@ int MidiPlayer_MSC::open() {
return ret;
}
-bool MidiPlayer_MSC::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MidiPlayer_MSC::close() {
stop();
diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp
index aeb934fd8b..6d80b5dbc1 100644
--- a/engines/parallaction/sound_ns.cpp
+++ b/engines/parallaction/sound_ns.cpp
@@ -38,7 +38,7 @@
namespace Parallaction {
-class MidiPlayer : public MidiDriver {
+class MidiPlayer : public MidiDriver_BASE {
public:
enum {
@@ -59,14 +59,9 @@ public:
// MidiDriver interface
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
private:
@@ -177,10 +172,6 @@ int MidiPlayer::open() {
return ret;
}
-bool MidiPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MidiPlayer::close() {
stop();
diff --git a/engines/queen/music.h b/engines/queen/music.h
index 50f7b3d255..898abb42d9 100644
--- a/engines/queen/music.h
+++ b/engines/queen/music.h
@@ -39,7 +39,7 @@ struct TuneData;
class QueenEngine;
-class MidiMusic : public MidiDriver {
+class MidiMusic : public MidiDriver_BASE {
public:
MidiMusic(QueenEngine *vm);
~MidiMusic();
@@ -57,20 +57,9 @@ public:
void toggleVChange();
//MidiDriver interface implementation
- int open() { return 0; }
- bool isOpen() const { return true; }
- void close() {}
void send(uint32 b);
-
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
-
- //Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
protected:
enum {
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp
index 3e1f3e3f3d..b6835052cf 100644
--- a/engines/saga/music.cpp
+++ b/engines/saga/music.cpp
@@ -76,10 +76,6 @@ int MusicDriver::open() {
return 0;
}
-bool MusicDriver::isOpen() const {
- return _driver->isOpen();
-}
-
void MusicDriver::setVolume(int volume) {
volume = CLIP(volume, 0, 255);
diff --git a/engines/saga/music.h b/engines/saga/music.h
index 22d957eb06..0b7d21d99c 100644
--- a/engines/saga/music.h
+++ b/engines/saga/music.h
@@ -44,7 +44,7 @@ enum MusicFlags {
MUSIC_DEFAULT = 0xffff
};
-class MusicDriver : public MidiDriver {
+class MusicDriver : public MidiDriver_BASE {
public:
MusicDriver();
~MusicDriver();
@@ -67,16 +67,10 @@ public:
void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { _driver->setTimerCallback(timerParam, timerProc); }
uint32 getBaseTempo() { return _driver->getBaseTempo(); }
- //Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
Common::Mutex _mutex;
protected:
- static void onTimer(void *data);
-
MidiChannel *_channel[16];
MidiDriver *_driver;
MusicType _driverType;
diff --git a/engines/sci/sound/drivers/cms.cpp b/engines/sci/sound/drivers/cms.cpp
index ff38e1c554..051fa7f1fd 100644
--- a/engines/sci/sound/drivers/cms.cpp
+++ b/engines/sci/sound/drivers/cms.cpp
@@ -785,7 +785,7 @@ public:
int open(ResourceManager *resMan) {
if (_driver)
- return MERR_ALREADY_OPEN;
+ return MidiDriver::MERR_ALREADY_OPEN;
_driver = new MidiDriver_CMS(g_system->getMixer(), resMan);
int driverRetVal = _driver->open();
diff --git a/engines/sci/sound/drivers/fb01.cpp b/engines/sci/sound/drivers/fb01.cpp
index ce48b7f1f8..971c2ff92d 100644
--- a/engines/sci/sound/drivers/fb01.cpp
+++ b/engines/sci/sound/drivers/fb01.cpp
@@ -129,7 +129,7 @@ private:
MidiPlayer_Fb01::MidiPlayer_Fb01(SciVersion version) : MidiPlayer(version), _playSwitch(true), _masterVolume(15), _timerParam(NULL), _timerProc(NULL) {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI);
- _driver = createMidi(dev);
+ _driver = MidiDriver::createMidi(dev);
_sysExBuf[0] = 0x43;
_sysExBuf[1] = 0x75;
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index d16655928e..381f2aab57 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -132,7 +132,7 @@ private:
MidiPlayer_Midi::MidiPlayer_Midi(SciVersion version) : MidiPlayer(version), _playSwitch(true), _masterVolume(15), _isMt32(false), _hasReverb(false), _useMT32Track(true) {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI);
- _driver = createMidi(dev);
+ _driver = MidiDriver::createMidi(dev);
if (MidiDriver::getMusicType(dev) == MT_MT32 || ConfMan.getBool("native_mt32"))
_isMt32 = true;
diff --git a/engines/sci/sound/drivers/mididriver.h b/engines/sci/sound/drivers/mididriver.h
index 5cecebd325..2038725dbe 100644
--- a/engines/sci/sound/drivers/mididriver.h
+++ b/engines/sci/sound/drivers/mididriver.h
@@ -76,7 +76,7 @@ enum {
#define SCI_MIDI_CONTROLLER(status) ((status & 0xF0) == 0xB0)
-class MidiPlayer : public MidiDriver {
+class MidiPlayer : public MidiDriver_BASE {
protected:
MidiDriver *_driver;
int8 _reverb;
@@ -89,13 +89,10 @@ public:
return open(resMan);
}
virtual int open(ResourceManager *resMan) { return _driver->open(); }
- bool isOpen() const { return _driver->isOpen(); }
virtual void close() { _driver->close(); }
virtual void send(uint32 b) { _driver->send(b); }
- uint32 getBaseTempo() { return _driver->getBaseTempo(); }
+ virtual uint32 getBaseTempo() { return _driver->getBaseTempo(); }
virtual bool hasRhythmChannel() const = 0;
- MidiChannel *allocateChannel() { return _driver->allocateChannel(); }
- MidiChannel *getPercussionChannel() { return _driver->getPercussionChannel(); }
virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) { _driver->setTimerCallback(timer_param, timer_proc); }
virtual byte getPlayId() const = 0;
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index d1153a02ef..7d46650d2e 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -155,7 +155,7 @@ struct CommandQueue {
//
//////////////////////////////////////////////////
-class Player : public MidiDriver {
+class Player : public MidiDriver_BASE {
/*
* External SysEx handler functions shall each be defined in
* a separate file. This header file shall be included at the
@@ -282,17 +282,9 @@ public:
public:
// MidiDriver interface
- int open() { return 0; }
- bool isOpen() const { return true; }
- void close() { }
void send(uint32 b);
- const char *getErrorName(int error_code) { return "Unknown"; }
void sysEx(const byte *msg, uint16 length);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timer_param, void(*timer_proc)(void *)) { }
- uint32 getBaseTempo();
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
};
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 9958a934de..4d185d94d7 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -986,10 +986,6 @@ void Player::fixAfterLoad() {
}
}
-uint32 Player::getBaseTempo() {
- return (_midi ? _midi->getBaseTempo() : 0);
-}
-
void Player::metaEvent(byte type, byte *msg, uint16 len) {
if (type == 0x2F)
clear();
diff --git a/engines/testbed/midi.cpp b/engines/testbed/midi.cpp
index 673f5d8547..7ec24aa670 100644
--- a/engines/testbed/midi.cpp
+++ b/engines/testbed/midi.cpp
@@ -96,7 +96,7 @@ TestExitStatus MidiTests::playMidiMusic() {
int errCode = driver->open();
if (errCode) {
- Common::String errMsg = driver->getErrorName(errCode);
+ Common::String errMsg = MidiDriver::getErrorName(errCode);
Testsuite::writeOnScreen(errMsg, Common::Point(0, 100));
Testsuite::logPrintf("Error! %s", errMsg.c_str());
return kTestFailed;
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index fb0f6b94fb..3e0d87bbb8 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -432,10 +432,6 @@ int MidiMusicPlayer::open() {
return 0;
}
-bool MidiMusicPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MidiMusicPlayer::close() {
stop();
if (_driver) {
diff --git a/engines/tinsel/music.h b/engines/tinsel/music.h
index 8f5acc51d0..a75f2b8617 100644
--- a/engines/tinsel/music.h
+++ b/engines/tinsel/music.h
@@ -60,7 +60,7 @@ SCNHANDLE GetTrackOffset(int trackNumber);
void dumpMusic();
-class MidiMusicPlayer : public MidiDriver {
+class MidiMusicPlayer : public MidiDriver_BASE {
public:
MidiMusicPlayer(MidiDriver *driver);
~MidiMusicPlayer();
@@ -80,23 +80,16 @@ public:
//MidiDriver interface implementation
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
-
// The original sets the "sequence timing" to 109 Hz, whatever that
// means. The default is 120.
uint32 getBaseTempo() { return _driver ? (109 * _driver->getBaseTempo()) / 120 : 0; }
- //Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-
protected:
static void onTimer(void *data);
diff --git a/engines/touche/midi.cpp b/engines/touche/midi.cpp
index c1270dd2e2..c6c7a60dfd 100644
--- a/engines/touche/midi.cpp
+++ b/engines/touche/midi.cpp
@@ -107,10 +107,6 @@ int MidiPlayer::open() {
return ret;
}
-bool MidiPlayer::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
void MidiPlayer::close() {
stop();
diff --git a/engines/touche/midi.h b/engines/touche/midi.h
index 75f33269a7..a750f12bec 100644
--- a/engines/touche/midi.h
+++ b/engines/touche/midi.h
@@ -39,7 +39,7 @@ namespace Common {
namespace Touche {
-class MidiPlayer : public MidiDriver {
+class MidiPlayer : public MidiDriver_BASE {
public:
enum {
@@ -59,14 +59,9 @@ public:
// MidiDriver interface
int open();
- bool isOpen() const;
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
- void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
- uint32 getBaseTempo() { return _driver ? _driver->getBaseTempo() : 0; }
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
private: