diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index 2674ed6d6..62dc94a8b 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -94,6 +94,20 @@ void DivPlatformOPLL::acquire_ymfm(short** buf, size_t len) { } void DivPlatformOPLL::acquire_emu(short** buf, size_t len) { + thread_local int os; + + for (size_t h=0; h32767) os=32767; + + buf[0][h]=os; + } } void DivPlatformOPLL::acquire(short** buf, size_t len) { @@ -1103,10 +1117,18 @@ void DivPlatformOPLL::setFlags(const DivConfig& flags) { chipClock=COLOR_NTSC; } CHECK_CUSTOM_CLOCK; - rate=chipClock/36; patchSet=flags.getInt("patchSet",0); + if (selCore==1) { + rate=chipClock/72; + } else { + rate=chipClock/36; + } for (int i=0; i<11; i++) { - oscBuf[i]->rate=rate/2; + if (selCore==1) { + oscBuf[i]->rate=rate; + } else { + oscBuf[i]->rate=rate/2; + } } noTopHatFreq=flags.getBool("noTopHatFreq",false); fixedAll=flags.getBool("fixedAll",true); @@ -1117,6 +1139,12 @@ int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, const DivConf dumpWrites=false; skipRegisterWrites=false; patchSet=0; + fm_emu=NULL; + if (selCore==1) { + fm_emu=OPLL_new(72,1); + OPLL_setChipType(fm_emu,vrc7?1:0); + } + for (int i=0; i<11; i++) { isMuted[i]=false; oscBuf[i]=new DivDispatchOscBuffer; @@ -1131,6 +1159,10 @@ void DivPlatformOPLL::quit() { for (int i=0; i<11; i++) { delete oscBuf[i]; } + if (fm_emu!=NULL) { + OPLL_delete(fm_emu); + fm_emu=NULL; + } } DivPlatformOPLL::~DivPlatformOPLL() {