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;

View file

@ -1628,6 +1628,18 @@ class FurnaceGUI {
int opl2Core;
int opl3Core;
int esfmCore;
int opllCore;
int bubsysQuality;
int dsidQuality;
int gbQuality;
int ndsQuality;
int pceQuality;
int pnQuality;
int saaQuality;
int sccQuality;
int smQuality;
int swanQuality;
int vbQuality;
int arcadeCoreRender;
int ym2612CoreRender;
int snCoreRender;
@ -1639,6 +1651,18 @@ class FurnaceGUI {
int opl2CoreRender;
int opl3CoreRender;
int esfmCoreRender;
int opllCoreRender;
int bubsysQualityRender;
int dsidQualityRender;
int gbQualityRender;
int ndsQualityRender;
int pceQualityRender;
int pnQualityRender;
int saaQualityRender;
int sccQualityRender;
int smQualityRender;
int swanQualityRender;
int vbQualityRender;
int pcSpeakerOutMethod;
String yrw801Path;
String tg100Path;
@ -1838,6 +1862,7 @@ class FurnaceGUI {
opl2Core(0),
opl3Core(0),
esfmCore(0),
opllCore(0),
arcadeCoreRender(1),
ym2612CoreRender(0),
snCoreRender(0),
@ -1849,6 +1874,7 @@ class FurnaceGUI {
opl2CoreRender(0),
opl3CoreRender(0),
esfmCoreRender(0),
opllCoreRender(0),
pcSpeakerOutMethod(0),
yrw801Path(""),
tg100Path(""),

View file

@ -174,6 +174,20 @@ const char* esfmCores[]={
"ESFMu (fast)"
};
const char* opllCores[]={
"Nuked-OPLL",
"emu2413"
};
const char* coreQualities[]={
"Horrible",
"Low",
"Medium",
"High",
"Ultra",
"Ultimate"
};
const char* pcspkrOutMethods[]={
"evdev SND_TONE",
"KIOCSOUND on /dev/tty1",
@ -1663,6 +1677,17 @@ void FurnaceGUI::drawSettings() {
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##ESFMCoreRender",&settings.esfmCoreRender,esfmCores,2)) settingsChanged=true;
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("OPLL");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPLLCore",&settings.opllCore,opllCores,2)) settingsChanged=true;
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPLLCoreRender",&settings.opllCoreRender,opllCores,2)) settingsChanged=true;
ImGui::EndTable();
}
ImGui::Separator();
@ -4165,6 +4190,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.opl2Core=conf.getInt("opl2Core",0);
settings.opl3Core=conf.getInt("opl3Core",0);
settings.esfmCore=conf.getInt("esfmCore",0);
settings.opllCore=conf.getInt("opllCore",0);
settings.arcadeCoreRender=conf.getInt("arcadeCoreRender",1);
settings.ym2612CoreRender=conf.getInt("ym2612CoreRender",0);
settings.snCoreRender=conf.getInt("snCoreRender",0);
@ -4176,6 +4202,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.opl2CoreRender=conf.getInt("opl2CoreRender",0);
settings.opl3CoreRender=conf.getInt("opl3CoreRender",0);
settings.esfmCoreRender=conf.getInt("esfmCoreRender",0);
settings.opllCoreRender=conf.getInt("opllCoreRender",0);
settings.pcSpeakerOutMethod=conf.getInt("pcSpeakerOutMethod",0);
@ -4205,6 +4232,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.opl2Core,0,2);
clampSetting(settings.opl3Core,0,2);
clampSetting(settings.esfmCore,0,1);
clampSetting(settings.opllCore,0,1);
clampSetting(settings.arcadeCoreRender,0,1);
clampSetting(settings.ym2612CoreRender,0,2);
clampSetting(settings.snCoreRender,0,1);
@ -4216,6 +4244,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.opl2CoreRender,0,2);
clampSetting(settings.opl3CoreRender,0,2);
clampSetting(settings.esfmCoreRender,0,1);
clampSetting(settings.opllCoreRender,0,1);
clampSetting(settings.pcSpeakerOutMethod,0,4);
clampSetting(settings.mainFont,0,6);
clampSetting(settings.patFont,0,6);
@ -4647,6 +4676,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("opl2Core",settings.opl2Core);
conf.set("opl3Core",settings.opl3Core);
conf.set("esfmCore",settings.esfmCore);
conf.set("opllCore",settings.opllCore);
conf.set("arcadeCoreRender",settings.arcadeCoreRender);
conf.set("ym2612CoreRender",settings.ym2612CoreRender);
conf.set("snCoreRender",settings.snCoreRender);
@ -4658,6 +4688,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("opl2CoreRender",settings.opl2CoreRender);
conf.set("opl3CoreRender",settings.opl3CoreRender);
conf.set("esfmCoreRender",settings.esfmCoreRender);
conf.set("opllCoreRender",settings.opllCoreRender);
conf.set("pcSpeakerOutMethod",settings.pcSpeakerOutMethod);
@ -4703,6 +4734,7 @@ void FurnaceGUI::commitSettings() {
settings.opl2Core!=e->getConfInt("opl2Core",0) ||
settings.opl3Core!=e->getConfInt("opl3Core",0) ||
settings.esfmCore!=e->getConfInt("esfmCore",0) ||
settings.opllCore!=e->getConfInt("opllCore",0) ||
settings.arcadeCoreRender!=e->getConfInt("arcadeCoreRender",0) ||
settings.ym2612CoreRender!=e->getConfInt("ym2612CoreRender",0) ||
settings.snCoreRender!=e->getConfInt("snCoreRender",0) ||
@ -4714,6 +4746,7 @@ void FurnaceGUI::commitSettings() {
settings.opl2CoreRender!=e->getConfInt("opl2CoreRender",0) ||
settings.opl3CoreRender!=e->getConfInt("opl3CoreRender",0) ||
settings.esfmCoreRender!=e->getConfInt("esfmCoreRender",0) ||
settings.opllCoreRender!=e->getConfInt("opllCoreRender",0) ||
settings.audioQuality!=e->getConfInt("audioQuality",0) ||
settings.audioHiPass!=e->getConfInt("audioHiPass",1)
);