From bed9da8b9dbbaa19d317f71663e42875c1717fda Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 30 Apr 2015 00:01:30 -0400 Subject: AUDIO: Remove all AudioStream access to OPL --- engines/sherlock/scalpel/drivers/adlib.cpp | 31 ++++++++++-------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'engines/sherlock/scalpel/drivers') diff --git a/engines/sherlock/scalpel/drivers/adlib.cpp b/engines/sherlock/scalpel/drivers/adlib.cpp index 033b4740a7..29a39f0c39 100644 --- a/engines/sherlock/scalpel/drivers/adlib.cpp +++ b/engines/sherlock/scalpel/drivers/adlib.cpp @@ -216,11 +216,11 @@ uint16 frequencyLookUpTable[SHERLOCK_ADLIB_NOTES_COUNT] = { 0x1DE6, 0x1E03, 0x1E22, 0x1E42, 0x1E65, 0x1E89 }; -class MidiDriver_SH_AdLib : public MidiDriver_Emulated { +class MidiDriver_SH_AdLib : public MidiDriver { public: MidiDriver_SH_AdLib(Audio::Mixer *mixer) - : MidiDriver_Emulated(mixer), _masterVolume(15), _opl(0), - _adlibTimerProc(0), _adlibTimerParam(0) { + : _masterVolume(15), _opl(0), + _adlibTimerProc(0), _adlibTimerParam(0), _isOpen(false) { memset(_voiceChannelMapping, 0, sizeof(_voiceChannelMapping)); } virtual ~MidiDriver_SH_AdLib() { } @@ -231,17 +231,12 @@ public: void send(uint32 b); MidiChannel *allocateChannel() { return NULL; } MidiChannel *getPercussionChannel() { return NULL; } + bool isOpen() const { return _isOpen; } + uint32 getBaseTempo() { return 1000000 / OPL::OPL::kDefaultCallbackFrequency; } - // AudioStream - int readBuffer(int16 *data, const int numSamples); - bool isStereo() const { return false; } - int getRate() const { return _mixer->getOutputRate(); } int getPolyphony() const { return SHERLOCK_ADLIB_VOICES_COUNT; } bool hasRhythmChannel() const { return false; } - // MidiDriver_Emulated - void generateSamples(int16 *buf, int len); - virtual void setTimerCallback(void *timerParam, Common::TimerManager::TimerProc timerProc); void setVolume(byte volume); @@ -268,6 +263,8 @@ private: Common::TimerManager::TimerProc _adlibTimerProc; void *_adlibTimerParam; + bool _isOpen; + // points to a MIDI channel for each of the new voice channels byte _voiceChannelMapping[SHERLOCK_ADLIB_VOICES_COUNT]; @@ -299,16 +296,16 @@ int MidiDriver_SH_AdLib::open() { _opl->init(); - MidiDriver_Emulated::open(); + _isOpen = true; _opl->start(new Common::Functor0Mem(this, &MidiDriver_SH_AdLib::onTimer)); - _mixer->playStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, _mixer->kMaxChannelVolume, 0, DisposeAfterUse::NO); return 0; } void MidiDriver_SH_AdLib::close() { - _mixer->stopHandle(_mixerSoundHandle); + // Stop the OPL timer + _opl->stop(); delete _opl; } @@ -427,14 +424,6 @@ void MidiDriver_SH_AdLib::send(uint32 b) { } } -void MidiDriver_SH_AdLib::generateSamples(int16 *data, int len) { - // Dummy implementation until we no longer inherit from MidiDriver_Emulated -} - -int MidiDriver_SH_AdLib::readBuffer(int16 *data, const int numSamples) { - return _opl->readBuffer(data, numSamples); -} - void MidiDriver_SH_AdLib::noteOn(byte MIDIchannel, byte note, byte velocity) { int16 oldestInUseChannel = -1; uint16 oldestInUseTimer = 0; -- cgit v1.2.3