AUDIO: Change several fake MidiDrivers to MidiDriver_BASE subclasses

Many engines follow the advice in audio/midiparser.h and create a
"pseudo-MidiDriver" subclass. But MidiParser really only needs a tiny
subset of the MidiDriver capabilities, namely those found in
MidiDriver_BASE. So we try to subclass from that whenever possible; this
allows us to remove many stub methods, and enables further future
simplifications.
This commit is contained in:
Max Horn 2011-03-23 15:23:26 +01:00
parent c70c8864f1
commit 29847ea42d
35 changed files with 45 additions and 255 deletions

@ -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;

@ -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;

@ -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"));

@ -84,10 +84,6 @@ int MidiPlayer::open() {
return 0;
}
bool MidiPlayer::isOpen() const {
return _driver && _driver->isOpen();
}
void MidiPlayer::close() {
stop();
// _system->lockMutex(_mutex);

@ -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

@ -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;

@ -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;

@ -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

@ -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

@ -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();

@ -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();

@ -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);

@ -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);

@ -694,10 +694,6 @@ int MidiMusic::open() {
return 0;
}
bool MidiMusic::isOpen() const {
return _driver != 0;
}
void MidiMusic::close() {
}

@ -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; }

@ -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) {

@ -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);

@ -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;

@ -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;

@ -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();

@ -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();

@ -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 {

@ -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);

@ -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;

@ -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();

@ -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;

@ -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;

@ -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;

@ -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; }
};

@ -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();

@ -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;

@ -432,10 +432,6 @@ int MidiMusicPlayer::open() {
return 0;
}
bool MidiMusicPlayer::isOpen() const {
return _driver && _driver->isOpen();
}
void MidiMusicPlayer::close() {
stop();
if (_driver) {

@ -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);

@ -107,10 +107,6 @@ int MidiPlayer::open() {
return ret;
}
bool MidiPlayer::isOpen() const {
return _driver && _driver->isOpen();
}
void MidiPlayer::close() {
stop();

@ -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: