diff options
Diffstat (limited to 'audio/softsynth/opl/mame.cpp')
-rw-r--r-- | audio/softsynth/opl/mame.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp index 2db7d421b6..696169be09 100644 --- a/audio/softsynth/opl/mame.cpp +++ b/audio/softsynth/opl/mame.cpp @@ -8,18 +8,19 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * LGPL licensed version of MAMEs fmopl (V0.37a modified) by * Tatsuyuki Satoh. Included from LGPL'ed AdPlug. + * */ #include <stdio.h> @@ -30,6 +31,8 @@ #include "mame.h" +#include "audio/mixer.h" +#include "common/system.h" #include "common/textconsole.h" #include "common/util.h" @@ -45,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); } @@ -73,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); } |