prepare for emu2413 core

This commit is contained in:
tildearrow 2024-04-03 16:22:51 -05:00
parent f0c85acfd7
commit d7ffda5420
17 changed files with 2174 additions and 13 deletions

View file

@ -428,6 +428,11 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
case DIV_SYSTEM_OPLL_DRUMS:
case DIV_SYSTEM_VRC7:
dispatch=new DivPlatformOPLL;
if (isRender) {
((DivPlatformOPLL*)dispatch)->setCore(eng->getConfInt("opllCoreRender",0));
} else {
((DivPlatformOPLL*)dispatch)->setCore(eng->getConfInt("opllCore",0));
}
((DivPlatformOPLL*)dispatch)->setVRC7(sys==DIV_SYSTEM_VRC7);
((DivPlatformOPLL*)dispatch)->setProperDrums(sys==DIV_SYSTEM_OPLL_DRUMS);
break;

View file

@ -93,8 +93,18 @@ void DivPlatformOPLL::acquire_nuked(short** buf, size_t len) {
void DivPlatformOPLL::acquire_ymfm(short** buf, size_t len) {
}
void DivPlatformOPLL::acquire_emu(short** buf, size_t len) {
}
void DivPlatformOPLL::acquire(short** buf, size_t len) {
acquire_nuked(buf,len);
switch (selCore) {
case 0:
acquire_nuked(buf,len);
break;
case 1:
acquire_emu(buf,len);
break;
}
}
void DivPlatformOPLL::tick(bool sysTick) {
@ -1073,8 +1083,8 @@ int DivPlatformOPLL::getPortaFloor(int ch) {
return (ch>5)?12:0;
}
void DivPlatformOPLL::setYMFM(bool use) {
useYMFM=use;
void DivPlatformOPLL::setCore(unsigned char which) {
selCore=which;
}
float DivPlatformOPLL::getPostAmp() {

View file

@ -26,6 +26,7 @@
extern "C" {
#include "../../../extern/Nuked-OPLL/opll.h"
}
#include "../../../extern/emu2413/emu2413.h"
class DivPlatformOPLL: public DivDispatch {
protected:
@ -55,6 +56,7 @@ class DivPlatformOPLL: public DivDispatch {
};
FixedQueue<QueuedWrite,512> writes;
opll_t fm;
OPLL* fm_emu;
int delay, lastCustomMemory;
unsigned char lastBusy;
unsigned char drumState;
@ -68,7 +70,7 @@ class DivPlatformOPLL: public DivDispatch {
unsigned char regPool[256];
bool useYMFM;
unsigned char selCore;
bool crapDrums;
bool properDrums, properDrumsSys, noTopHatFreq, fixedAll;
bool vrc7;
@ -88,6 +90,7 @@ class DivPlatformOPLL: public DivDispatch {
void acquire_nuked(short** buf, size_t len);
void acquire_ymfm(short** buf, size_t len);
void acquire_emu(short** buf, size_t len);
public:
void acquire(short** buf, size_t len);
@ -102,7 +105,7 @@ class DivPlatformOPLL: public DivDispatch {
void forceIns();
void tick(bool sysTick=true);
void muteChannel(int ch, bool mute);
void setYMFM(bool use);
void setCore(unsigned char which);
bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch);
bool getLegacyAlwaysSetVolume();

View file

@ -88,12 +88,10 @@ void DivPlatformPCE::acquire(short** buf, size_t len) {
}
// PCE part
cycles=0;
while (!writes.empty() && cycles<24) {
while (!writes.empty()) {
QueuedWrite w=writes.front();
pce->Write(cycles,w.addr,w.val);
pce->Write(0,w.addr,w.val);
regPool[w.addr&0x0f]=w.val;
//cycles+=2;
writes.pop();
}
memset(tempL,0,24*sizeof(int));
@ -585,7 +583,6 @@ void DivPlatformPCE::reset() {
lastPan=0xff;
memset(tempL,0,32*sizeof(int));
memset(tempR,0,32*sizeof(int));
cycles=0;
curChan=-1;
sampleBank=0;
lfoMode=0;
@ -599,7 +596,6 @@ void DivPlatformPCE::reset() {
for (int i=0; i<6; i++) {
chWrite(i,0x05,isMuted[i]?0:chan[i].pan);
}
delay=500;
}
int DivPlatformPCE::getOutputCount() {

View file

@ -68,7 +68,7 @@ class DivPlatformPCE: public DivDispatch {
FixedQueue<QueuedWrite,512> writes;
unsigned char lastPan;
int cycles, curChan, delay;
int curChan;
int tempL[32];
int tempR[32];
unsigned char sampleBank, lfoMode, lfoSpeed;