aboutsummaryrefslogtreecommitdiff
path: root/audio/fmopl.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2015-04-29 23:45:25 -0400
committerMatthew Hoops2015-07-07 20:19:47 -0400
commit8bcbcd6c167e8e7169f006da459f3cbe450a4a59 (patch)
treecab6d5bf2f9a1a80b73d7ec6caf63e9b9d05760c /audio/fmopl.cpp
parentdce05c520b2e1f273f395c986573f532ee698921 (diff)
downloadscummvm-rg350-8bcbcd6c167e8e7169f006da459f3cbe450a4a59.tar.gz
scummvm-rg350-8bcbcd6c167e8e7169f006da459f3cbe450a4a59.tar.bz2
scummvm-rg350-8bcbcd6c167e8e7169f006da459f3cbe450a4a59.zip
AUDIO: Change callback frequency without restarting the audio stream
Diffstat (limited to 'audio/fmopl.cpp')
-rw-r--r--audio/fmopl.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/audio/fmopl.cpp b/audio/fmopl.cpp
index 638da6c224..9af7afff54 100644
--- a/audio/fmopl.cpp
+++ b/audio/fmopl.cpp
@@ -183,14 +183,6 @@ void OPL::stop() {
_callback.reset();
}
-void OPL::setCallbackFrequency(int timerFrequency) {
- if (!isRunning())
- return;
-
- stopCallbacks();
- startCallbacks(timerFrequency);
-}
-
bool OPL::_hasInstance = false;
EmulatedOPL::EmulatedOPL() :
@@ -239,6 +231,17 @@ int EmulatedOPL::getRate() const {
}
void EmulatedOPL::startCallbacks(int timerFrequency) {
+ setCallbackFrequency(timerFrequency);
+ // TODO: Eventually start mixer playback here
+ //g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _handle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+}
+
+void EmulatedOPL::stopCallbacks() {
+ // TODO: Eventually stop mixer playback here
+ //g_system->getMixer()->stopHandle(*_handle);
+}
+
+void EmulatedOPL::setCallbackFrequency(int timerFrequency) {
_baseFreq = timerFrequency;
assert(_baseFreq != 0);
@@ -249,20 +252,6 @@ void EmulatedOPL::startCallbacks(int timerFrequency) {
// but less prone to arithmetic overflow.
_samplesPerTick = (d << FIXP_SHIFT) + (r << FIXP_SHIFT) / _baseFreq;
-
- // TODO: Eventually start mixer playback here
- //g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _handle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
-}
-
-void EmulatedOPL::stopCallbacks() {
- // TODO: Eventually stop mixer playback here
- //g_system->getMixer()->stopHandle(*_handle);
-}
-
-bool EmulatedOPL::isRunning() const {
- // TODO
- //return g_system->getMixer()->isSoundHandleActive(*_handle);
- return true;
}
} // End of namespace OPL