aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
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/gob
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/gob')
-rw-r--r--engines/gob/sound/adlib.cpp26
-rw-r--r--engines/gob/sound/adlib.h10
-rw-r--r--engines/gob/sound/musplayer.cpp8
3 files changed, 6 insertions, 38 deletions
diff --git a/engines/gob/sound/adlib.cpp b/engines/gob/sound/adlib.cpp
index 866eecf8bd..995cc48824 100644
--- a/engines/gob/sound/adlib.cpp
+++ b/engines/gob/sound/adlib.cpp
@@ -118,8 +118,6 @@ const uint16 AdLib::kHihatParams [kParamCount] = {
AdLib::AdLib(Audio::Mixer &mixer, int callbackFreq) : _mixer(&mixer), _opl(0),
_toPoll(0), _repCount(0), _first(true), _playing(false), _ended(true), _volume(0) {
- _rate = _mixer->getOutputRate();
-
initFreqs();
createOPL();
@@ -128,13 +126,9 @@ AdLib::AdLib(Audio::Mixer &mixer, int callbackFreq) : _mixer(&mixer), _opl(0),
syncVolume();
_opl->start(new Common::Functor0Mem<void, AdLib>(this, &AdLib::onTimer), callbackFreq);
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle,
- this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
AdLib::~AdLib() {
- _mixer->stopHandle(_handle);
-
delete _opl;
}
@@ -168,10 +162,6 @@ void AdLib::createOPL() {
}
}
-int AdLib::readBuffer(int16 *buffer, const int numSamples) {
- return _opl->readBuffer(buffer, numSamples);
-}
-
void AdLib::onTimer() {
Common::StackLock slock(_mutex);
@@ -218,22 +208,6 @@ void AdLib::onTimer() {
}
}
-bool AdLib::isStereo() const {
- return _opl->isStereo();
-}
-
-bool AdLib::endOfData() const {
- return false;
-}
-
-bool AdLib::endOfStream() const {
- return false;
-}
-
-int AdLib::getRate() const {
- return _rate;
-}
-
bool AdLib::isPlaying() const {
return _playing;
}
diff --git a/engines/gob/sound/adlib.h b/engines/gob/sound/adlib.h
index 2c83b15f5b..28ebf9d998 100644
--- a/engines/gob/sound/adlib.h
+++ b/engines/gob/sound/adlib.h
@@ -35,7 +35,7 @@ namespace OPL {
namespace Gob {
/** Base class for a player of an AdLib music format. */
-class AdLib : public Audio::AudioStream {
+class AdLib {
public:
AdLib(Audio::Mixer &mixer, int callbackFrequency);
virtual ~AdLib();
@@ -55,13 +55,6 @@ public:
void stopPlay();
void syncVolume();
-// AudioStream API
- int readBuffer(int16 *buffer, const int numSamples);
- bool isStereo() const;
- bool endOfData() const;
- bool endOfStream() const;
- int getRate() const;
-
protected:
enum kVoice {
kVoiceMelody0 = 0,
@@ -233,7 +226,6 @@ private:
Audio::Mixer *_mixer;
- Audio::SoundHandle _handle;
OPL::OPL *_opl;
Common::Mutex _mutex;
diff --git a/engines/gob/sound/musplayer.cpp b/engines/gob/sound/musplayer.cpp
index bf90d44735..2c0330e70a 100644
--- a/engines/gob/sound/musplayer.cpp
+++ b/engines/gob/sound/musplayer.cpp
@@ -57,8 +57,12 @@ uint32 MUSPlayer::pollMusic(bool first) {
return 0;
}
- if (first)
+ if (first) {
+ // Set the timer frequency on first run.
+ // Do not set it in rewind() for thread safety reasons.
+ setTimerFrequency((_ticksPerBeat * _tempo) / 60);
return *_playPos++;
+ }
uint16 delay = 0;
while (delay == 0) {
@@ -185,8 +189,6 @@ void MUSPlayer::rewind() {
setPercussionMode(_soundMode != 0);
setPitchRange(_pitchBendRange);
-
- setTimerFrequency((_ticksPerBeat * _tempo) / 60);
}
bool MUSPlayer::loadSND(Common::SeekableReadStream &snd) {