aboutsummaryrefslogtreecommitdiff
path: root/audio/softsynth
diff options
context:
space:
mode:
authorMatthew Hoops2015-04-03 01:05:03 -0400
committerMatthew Hoops2015-07-07 20:19:42 -0400
commit2e8f9dcec93653f1bd1f115662f9fcf3a5581fd8 (patch)
treee843e3f7de6172b24f4c54b260d663f9c0cc4a80 /audio/softsynth
parentf1f29302f5401c4782985cec4d47d069b99036ee (diff)
downloadscummvm-rg350-2e8f9dcec93653f1bd1f115662f9fcf3a5581fd8.tar.gz
scummvm-rg350-2e8f9dcec93653f1bd1f115662f9fcf3a5581fd8.tar.bz2
scummvm-rg350-2e8f9dcec93653f1bd1f115662f9fcf3a5581fd8.zip
AUDIO: Remove the sample rate configuration from the OPL code
Diffstat (limited to 'audio/softsynth')
-rw-r--r--audio/softsynth/adlib.cpp2
-rw-r--r--audio/softsynth/opl/dosbox.cpp9
-rw-r--r--audio/softsynth/opl/dosbox.h2
-rw-r--r--audio/softsynth/opl/mame.cpp6
-rw-r--r--audio/softsynth/opl/mame.h2
5 files changed, 12 insertions, 9 deletions
diff --git a/audio/softsynth/adlib.cpp b/audio/softsynth/adlib.cpp
index 98519343b4..49e69ecd57 100644
--- a/audio/softsynth/adlib.cpp
+++ b/audio/softsynth/adlib.cpp
@@ -1434,7 +1434,7 @@ int MidiDriver_ADLIB::open() {
_opl3Mode = false;
}
#endif
- _opl->init(getRate());
+ _opl->init();
_regCache = (byte *)calloc(256, 1);
diff --git a/audio/softsynth/opl/dosbox.cpp b/audio/softsynth/opl/dosbox.cpp
index 5c3d833f54..bcc73a9b9e 100644
--- a/audio/softsynth/opl/dosbox.cpp
+++ b/audio/softsynth/opl/dosbox.cpp
@@ -32,6 +32,7 @@
#include "dosbox.h"
#include "dbopl.h"
+#include "audio/mixer.h"
#include "common/system.h"
#include "common/scummsys.h"
#include "common/util.h"
@@ -156,7 +157,7 @@ void OPL::free() {
_emulator = 0;
}
-bool OPL::init(int rate) {
+bool OPL::init() {
free();
memset(&_reg, 0, sizeof(_reg));
@@ -167,19 +168,19 @@ bool OPL::init(int rate) {
return false;
DBOPL::InitTables();
- _emulator->Setup(rate);
+ _rate = g_system->getMixer()->getOutputRate();
+ _emulator->Setup(_rate);
if (_type == Config::kDualOpl2) {
// Setup opl3 mode in the hander
_emulator->WriteReg(0x105, 1);
}
- _rate = rate;
return true;
}
void OPL::reset() {
- init(_rate);
+ init();
}
void OPL::write(int port, int val) {
diff --git a/audio/softsynth/opl/dosbox.h b/audio/softsynth/opl/dosbox.h
index 513a49f6b8..d3df6ba6ed 100644
--- a/audio/softsynth/opl/dosbox.h
+++ b/audio/softsynth/opl/dosbox.h
@@ -87,7 +87,7 @@ public:
OPL(Config::OplType type);
~OPL();
- bool init(int rate);
+ bool init();
void reset();
void write(int a, int v);
diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp
index da75ba76ba..1a5810f6c8 100644
--- a/audio/softsynth/opl/mame.cpp
+++ b/audio/softsynth/opl/mame.cpp
@@ -31,6 +31,8 @@
#include "mame.h"
+#include "audio/mixer.h"
+#include "common/system.h"
#include "common/textconsole.h"
#include "common/util.h"
@@ -50,11 +52,11 @@ OPL::~OPL() {
_opl = 0;
}
-bool OPL::init(int rate) {
+bool OPL::init() {
if (_opl)
MAME::OPLDestroy(_opl);
- _opl = MAME::makeAdLibOPL(rate);
+ _opl = MAME::makeAdLibOPL(g_system->getMixer()->getOutputRate());
return (_opl != 0);
}
diff --git a/audio/softsynth/opl/mame.h b/audio/softsynth/opl/mame.h
index bd479d9e45..080cc6d171 100644
--- a/audio/softsynth/opl/mame.h
+++ b/audio/softsynth/opl/mame.h
@@ -181,7 +181,7 @@ public:
OPL() : _opl(0) {}
~OPL();
- bool init(int rate);
+ bool init();
void reset();
void write(int a, int v);