aboutsummaryrefslogtreecommitdiff
path: root/engines/queen
diff options
context:
space:
mode:
authorMatthew Hoops2015-04-30 00:01:30 -0400
committerMatthew Hoops2015-07-07 20:19:47 -0400
commitbed9da8b9dbbaa19d317f71663e42875c1717fda (patch)
tree56b714515cae107ae1f7992a2e85db1e9c800a8a /engines/queen
parent8bcbcd6c167e8e7169f006da459f3cbe450a4a59 (diff)
downloadscummvm-rg350-bed9da8b9dbbaa19d317f71663e42875c1717fda.tar.gz
scummvm-rg350-bed9da8b9dbbaa19d317f71663e42875c1717fda.tar.bz2
scummvm-rg350-bed9da8b9dbbaa19d317f71663e42875c1717fda.zip
AUDIO: Remove all AudioStream access to OPL
Diffstat (limited to 'engines/queen')
-rw-r--r--engines/queen/midiadlib.cpp12
-rw-r--r--engines/queen/midiadlib.h22
-rw-r--r--engines/queen/music.cpp2
3 files changed, 12 insertions, 24 deletions
diff --git a/engines/queen/midiadlib.cpp b/engines/queen/midiadlib.cpp
index 457767a2a0..f5bc0f4d58 100644
--- a/engines/queen/midiadlib.cpp
+++ b/engines/queen/midiadlib.cpp
@@ -28,7 +28,7 @@
namespace Queen {
int AdLibMidiDriver::open() {
- MidiDriver_Emulated::open();
+ _isOpen = true;
_opl = OPL::Config::create();
if (!_opl || !_opl->init())
error("Failed to create OPL");
@@ -41,12 +41,10 @@ int AdLibMidiDriver::open() {
}
_opl->start(new Common::Functor0Mem<void, AdLibMidiDriver>(this, &AdLibMidiDriver::onTimer));
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
return 0;
}
void AdLibMidiDriver::close() {
- _mixer->stopHandle(_mixerSoundHandle);
delete _opl;
}
@@ -110,14 +108,6 @@ void AdLibMidiDriver::metaEvent(byte type, byte *data, uint16 length) {
warning("Unhandled meta event %d len %d", event, length);
}
-void AdLibMidiDriver::generateSamples(int16 *data, int len) {
- // Dummy implementation
-}
-
-int AdLibMidiDriver::readBuffer(int16 *data, const int numSamples) {
- return _opl->readBuffer(data, numSamples);
-}
-
void AdLibMidiDriver::setTimerCallback(void *timerParam, Common::TimerManager::TimerProc timerProc) {
_adlibTimerProc = timerProc;
_adlibTimerParam = timerParam;
diff --git a/engines/queen/midiadlib.h b/engines/queen/midiadlib.h
index d5590253cb..8692e51840 100644
--- a/engines/queen/midiadlib.h
+++ b/engines/queen/midiadlib.h
@@ -22,14 +22,17 @@
#include "audio/fmopl.h"
#include "audio/mididrv.h"
-#include "audio/softsynth/emumidi.h"
namespace Queen {
-class AdLibMidiDriver : public MidiDriver_Emulated {
+class AdLibMidiDriver : public MidiDriver {
public:
- AdLibMidiDriver(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer) { _adlibWaveformSelect = 0; }
+ AdLibMidiDriver() {
+ _adlibWaveformSelect = 0;
+ _isOpen = false;
+ }
+
~AdLibMidiDriver() {}
// MidiDriver
@@ -40,14 +43,8 @@ public:
MidiChannel *allocateChannel() { return 0; }
MidiChannel *getPercussionChannel() { return 0; }
void setTimerCallback(void *timerParam, Common::TimerManager::TimerProc timerProc);
-
- // AudioStream
- int readBuffer(int16 *data, const int numSamples);
- bool isStereo() const { return false; }
- int getRate() const { return _mixer->getOutputRate(); }
-
- // MidiDriver_Emulated
- void generateSamples(int16 *buf, int len);
+ bool isOpen() const { return _isOpen; }
+ uint32 getBaseTempo() { return 1000000 / OPL::OPL::kDefaultCallbackFrequency; }
void setVolume(uint32 volume);
@@ -74,8 +71,8 @@ private:
void adlibTurnNoteOn(int channel, int note);
void adlibSetupChannelFromSequence(int channel, const uint8 *src, int fl);
void adlibSetupChannel(int channel, const uint16 *src, int fl);
- void adlibSetChannelVolume(int channel, uint8 volume);
void adlibSetNoteVolume(int channel, int volume);
+ void adlibSetChannelVolume(int channel, uint8 volume);
void adlibSetupChannelHelper(int channel);
void adlibSetChannel0x40(int channel);
void adlibSetChannel0xC0(int channel);
@@ -106,6 +103,7 @@ private:
uint16 _adlibMetaSequenceData[28];
uint8 _adlibChannelsVolumeTable[11];
+ bool _isOpen;
Common::TimerManager::TimerProc _adlibTimerProc;
void *_adlibTimerParam;
diff --git a/engines/queen/music.cpp b/engines/queen/music.cpp
index 600956ada5..9f74aab915 100644
--- a/engines/queen/music.cpp
+++ b/engines/queen/music.cpp
@@ -68,7 +68,7 @@ MidiMusic::MidiMusic(QueenEngine *vm)
// if (READ_LE_UINT16(_musicData + 2) != infoOffset) {
// defaultAdLibVolume = _musicData[infoOffset];
// }
- _driver = new AdLibMidiDriver(g_system->getMixer());
+ _driver = new AdLibMidiDriver();
} else {
_driver = MidiDriver::createMidi(dev);
if (_nativeMT32) {