diff options
Diffstat (limited to 'audio/softsynth/opl/mame.cpp')
-rw-r--r-- | audio/softsynth/opl/mame.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp index da75ba76ba..696169be09 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" @@ -46,15 +48,19 @@ namespace OPL { namespace MAME { OPL::~OPL() { + stop(); MAME::OPLDestroy(_opl); _opl = 0; } -bool OPL::init(int rate) { - if (_opl) +bool OPL::init() { + if (_opl) { + stopCallbacks(); MAME::OPLDestroy(_opl); + } + + _opl = MAME::makeAdLibOPL(g_system->getMixer()->getOutputRate()); - _opl = MAME::makeAdLibOPL(rate); return (_opl != 0); } @@ -74,7 +80,7 @@ void OPL::writeReg(int r, int v) { MAME::OPLWriteReg(_opl, r, v); } -void OPL::readBuffer(int16 *buffer, int length) { +void OPL::generateSamples(int16 *buffer, int length) { MAME::YM3812UpdateOne(_opl, buffer, length); } |