From 2e8f9dcec93653f1bd1f115662f9fcf3a5581fd8 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 3 Apr 2015 01:05:03 -0400 Subject: AUDIO: Remove the sample rate configuration from the OPL code --- audio/softsynth/adlib.cpp | 2 +- audio/softsynth/opl/dosbox.cpp | 9 +++++---- audio/softsynth/opl/dosbox.h | 2 +- audio/softsynth/opl/mame.cpp | 6 ++++-- audio/softsynth/opl/mame.h | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) (limited to 'audio/softsynth') 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); -- cgit v1.2.3