diff options
author | Matthew Hoops | 2015-04-21 00:43:43 -0400 |
---|---|---|
committer | Matthew Hoops | 2015-07-07 20:19:44 -0400 |
commit | 5b06eef1597ce701a4f6d16854be077b952d29f7 (patch) | |
tree | eb12ff6939c312b1b56c8506aa0cb3e39fa2e1ca /audio | |
parent | cc6e304af1b7021c7ee471f55c0674dac1bfb253 (diff) | |
download | scummvm-rg350-5b06eef1597ce701a4f6d16854be077b952d29f7.tar.gz scummvm-rg350-5b06eef1597ce701a4f6d16854be077b952d29f7.tar.bz2 scummvm-rg350-5b06eef1597ce701a4f6d16854be077b952d29f7.zip |
AUDIO: Allow for changing the OPL timer rate
Diffstat (limited to 'audio')
-rw-r--r-- | audio/fmopl.cpp | 14 | ||||
-rw-r--r-- | audio/fmopl.h | 12 |
2 files changed, 26 insertions, 0 deletions
diff --git a/audio/fmopl.cpp b/audio/fmopl.cpp index c9cb1040d6..07c5b44427 100644 --- a/audio/fmopl.cpp +++ b/audio/fmopl.cpp @@ -183,6 +183,14 @@ void OPL::stop() { _callback.reset(); } +void OPL::setCallbackFrequency(int timerFrequency) { + if (!isRunning()) + return; + + stopCallbacks(); + startCallbacks(timerFrequency); +} + bool OPL::_hasInstance = false; EmulatedOPL::EmulatedOPL() : @@ -249,4 +257,10 @@ void EmulatedOPL::stopCallbacks() { //g_system->getMixer()->stopHandle(*_handle); } +bool EmulatedOPL::isRunning() const { + // TODO + //return g_system->getMixer()->isSoundHandleActive(*_handle); + return true; +} + } // End of namespace OPL diff --git a/audio/fmopl.h b/audio/fmopl.h index 0e2e2b2dda..243cd294e8 100644 --- a/audio/fmopl.h +++ b/audio/fmopl.h @@ -175,6 +175,17 @@ public: */ void stop(); + /** + * Is the OPL running? + */ + virtual bool isRunning() const = 0; + + /** + * Change the callback frequency. This has no effect if start() + * has not already been called. + */ + void setCallbackFrequency(int timerFrequency); + enum { /** * The default callback frequency that start() uses @@ -206,6 +217,7 @@ public: // OPL API int readBuffer(int16 *buffer, const int numSamples); + bool isRunning() const; int getRate() const; |