diff options
author | Matthew Hoops | 2015-04-30 00:01:30 -0400 |
---|---|---|
committer | Matthew Hoops | 2015-07-07 20:19:47 -0400 |
commit | bed9da8b9dbbaa19d317f71663e42875c1717fda (patch) | |
tree | 56b714515cae107ae1f7992a2e85db1e9c800a8a /engines/sherlock/scalpel/drivers | |
parent | 8bcbcd6c167e8e7169f006da459f3cbe450a4a59 (diff) | |
download | scummvm-rg350-bed9da8b9dbbaa19d317f71663e42875c1717fda.tar.gz scummvm-rg350-bed9da8b9dbbaa19d317f71663e42875c1717fda.tar.bz2 scummvm-rg350-bed9da8b9dbbaa19d317f71663e42875c1717fda.zip |
AUDIO: Remove all AudioStream access to OPL
Diffstat (limited to 'engines/sherlock/scalpel/drivers')
-rw-r--r-- | engines/sherlock/scalpel/drivers/adlib.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
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<void, MidiDriver_SH_AdLib>(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; |