YM2608-LLE, part 1 - DOES NOT WORK

This commit is contained in:
tildearrow 2024-04-25 20:25:34 -05:00
parent 790502726f
commit 94e9aee874
6 changed files with 98 additions and 36 deletions

View file

@ -358,34 +358,34 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
case DIV_SYSTEM_YM2610_FULL:
dispatch=new DivPlatformYM2610;
if (isRender) {
((DivPlatformYM2610*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2610*)dispatch)->setCombo(eng->getConfInt("opnbCoreRender",1));
} else {
((DivPlatformYM2610*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2610*)dispatch)->setCombo(eng->getConfInt("opnbCore",1));
}
break;
case DIV_SYSTEM_YM2610_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT:
dispatch=new DivPlatformYM2610Ext;
if (isRender) {
((DivPlatformYM2610Ext*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2610Ext*)dispatch)->setCombo(eng->getConfInt("opnbCoreRender",1));
} else {
((DivPlatformYM2610Ext*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2610Ext*)dispatch)->setCombo(eng->getConfInt("opnbCore",1));
}
break;
case DIV_SYSTEM_YM2610B:
dispatch=new DivPlatformYM2610B;
if (isRender) {
((DivPlatformYM2610B*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2610B*)dispatch)->setCombo(eng->getConfInt("opnbCoreRender",1));
} else {
((DivPlatformYM2610B*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2610B*)dispatch)->setCombo(eng->getConfInt("opnbCore",1));
}
break;
case DIV_SYSTEM_YM2610B_EXT:
dispatch=new DivPlatformYM2610BExt;
if (isRender) {
((DivPlatformYM2610BExt*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2610BExt*)dispatch)->setCombo(eng->getConfInt("opnbCoreRender",1));
} else {
((DivPlatformYM2610BExt*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2610BExt*)dispatch)->setCombo(eng->getConfInt("opnbCore",1));
}
break;
case DIV_SYSTEM_AMIGA:
@ -411,33 +411,33 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
case DIV_SYSTEM_YM2203:
dispatch=new DivPlatformYM2203;
if (isRender) {
((DivPlatformYM2203*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2203*)dispatch)->setCombo(eng->getConfInt("opn1CoreRender",1));
} else {
((DivPlatformYM2203*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2203*)dispatch)->setCombo(eng->getConfInt("opn1Core",1));
}
break;
case DIV_SYSTEM_YM2203_EXT:
dispatch=new DivPlatformYM2203Ext;
if (isRender) {
((DivPlatformYM2203Ext*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2203Ext*)dispatch)->setCombo(eng->getConfInt("opn1CoreRender",1));
} else {
((DivPlatformYM2203Ext*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2203Ext*)dispatch)->setCombo(eng->getConfInt("opn1Core",1));
}
break;
case DIV_SYSTEM_YM2608:
dispatch=new DivPlatformYM2608;
if (isRender) {
((DivPlatformYM2608*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2608*)dispatch)->setCombo(eng->getConfInt("opnaCoreRender",1));
} else {
((DivPlatformYM2608*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2608*)dispatch)->setCombo(eng->getConfInt("opnaCore",1));
}
break;
case DIV_SYSTEM_YM2608_EXT:
dispatch=new DivPlatformYM2608Ext;
if (isRender) {
((DivPlatformYM2608Ext*)dispatch)->setCombo(eng->getConfInt("opnCoreRender",1)==1);
((DivPlatformYM2608Ext*)dispatch)->setCombo(eng->getConfInt("opnaCoreRender",1));
} else {
((DivPlatformYM2608Ext*)dispatch)->setCombo(eng->getConfInt("opnCore",1)==1);
((DivPlatformYM2608Ext*)dispatch)->setCombo(eng->getConfInt("opnaCore",1));
}
break;
case DIV_SYSTEM_OPLL:

View file

@ -158,7 +158,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
unsigned char lastExtChPan;
unsigned short ssgVol;
unsigned short fmVol;
bool extSys, useCombo, fbAllOps;
bool extSys, fbAllOps;
unsigned char useCombo;
DivConfig ayFlags;
@ -180,10 +181,10 @@ class DivPlatformOPN: public DivPlatformFMBase {
ssgVol(128),
fmVol(256),
extSys(isExtSys),
useCombo(false),
fbAllOps(false) {}
fbAllOps(false),
useCombo(0) {}
public:
void setCombo(bool combo) {
void setCombo(unsigned char combo) {
useCombo=combo;
}
virtual int mapVelocity(int ch, float vel) {

View file

@ -298,7 +298,9 @@ double DivPlatformYM2608::NOTE_ADPCMB(int note) {
}
void DivPlatformYM2608::acquire(short** buf, size_t len) {
if (useCombo) {
if (useCombo==2) {
acquire_lle(buf,len);
} else if (useCombo==1) {
acquire_combo(buf,len);
} else {
acquire_ymfm(buf,len);
@ -488,6 +490,14 @@ void DivPlatformYM2608::acquire_ymfm(short** buf, size_t len) {
}
}
void DivPlatformYM2608::acquire_lle(short** buf, size_t len) {
for (size_t h=0; h<len; h++) {
FMOPNA_Clock(&fm_lle,0);
FMOPNA_Clock(&fm_lle,1);
}
}
void DivPlatformYM2608::tick(bool sysTick) {
// FM
for (int i=0; i<6; i++) {
@ -1501,6 +1511,7 @@ void DivPlatformYM2608::reset() {
OPN2_Reset(&fm_nuked);
OPN2_SetChipType(&fm_nuked,ym3438_mode_opn);
fm->reset();
memset(&fm_lle,0,sizeof(fmopna_t));
for (int i=0; i<16; i++) {
chan[i]=DivPlatformOPN::OPNChannelStereo();
chan[i].std.setEngine(parent);

View file

@ -22,6 +22,9 @@
#include "fmshared_OPN.h"
#include "sound/ymfm/ymfm_opn.h"
extern "C" {
#include "../../../extern/YM2608-LLE/fmopna_2608.h"
}
#include "ay.h"
@ -50,6 +53,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
ym3438_t fm_nuked;
ymfm::ym2608* fm;
ymfm::ym2608::output_data fmout;
fmopna_t fm_lle;
unsigned char* adpcmBMem;
size_t adpcmBMemLen;
@ -76,6 +80,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
void acquire_combo(short** buf, size_t len);
void acquire_ymfm(short** buf, size_t len);
void acquire_lle(short** buf, size_t len);
public:
void acquire(short** buf, size_t len);

View file

@ -1659,7 +1659,9 @@ class FurnaceGUI {
int fdsCore;
int c64Core;
int pokeyCore;
int opnCore;
int opn1Core;
int opnaCore;
int opnbCore;
int opl2Core;
int opl3Core;
int esfmCore;
@ -1682,7 +1684,9 @@ class FurnaceGUI {
int fdsCoreRender;
int c64CoreRender;
int pokeyCoreRender;
int opnCoreRender;
int opn1CoreRender;
int opnaCoreRender;
int opnbCoreRender;
int opl2CoreRender;
int opl3CoreRender;
int esfmCoreRender;
@ -1898,7 +1902,9 @@ class FurnaceGUI {
fdsCore(0),
c64Core(0),
pokeyCore(1),
opnCore(1),
opn1Core(1),
opnaCore(1),
opnbCore(1),
opl2Core(0),
opl3Core(0),
esfmCore(0),
@ -1921,7 +1927,9 @@ class FurnaceGUI {
fdsCoreRender(1),
c64CoreRender(1),
pokeyCoreRender(1),
opnCoreRender(1),
opn1CoreRender(1),
opnaCoreRender(1),
opnbCoreRender(1),
opl2CoreRender(0),
opl3CoreRender(0),
esfmCoreRender(0),

View file

@ -154,7 +154,8 @@ const char* pokeyCores[]={
const char* opnCores[]={
"ymfm only",
"Nuked-OPN2 (FM) + ymfm (SSG/ADPCM)"
"Nuked-OPN2 (FM) + ymfm (SSG/ADPCM)",
"YM2608-LLE"
};
const char* opl2Cores[]={
@ -1706,13 +1707,35 @@ void FurnaceGUI::drawSettings() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("OPN/OPNA/OPNB");
ImGui::Text("OPN");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPNCore",&settings.opnCore,opnCores,2)) settingsChanged=true;
if (ImGui::Combo("##OPNCore",&settings.opn1Core,opnCores,3)) settingsChanged=true;
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPNCoreRender",&settings.opnCoreRender,opnCores,2)) settingsChanged=true;
if (ImGui::Combo("##OPNCoreRender",&settings.opn1CoreRender,opnCores,3)) settingsChanged=true;
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("OPNA");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPNACore",&settings.opnaCore,opnCores,3)) settingsChanged=true;
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPNACoreRender",&settings.opnaCoreRender,opnCores,3)) settingsChanged=true;
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("OPNB");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPNBCore",&settings.opnbCore,opnCores,3)) settingsChanged=true;
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##OPNBCoreRender",&settings.opnbCoreRender,opnCores,3)) settingsChanged=true;
ImGui::TableNextRow();
ImGui::TableNextColumn();
@ -4338,7 +4361,9 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.fdsCore=conf.getInt("fdsCore",0);
settings.c64Core=conf.getInt("c64Core",0);
settings.pokeyCore=conf.getInt("pokeyCore",1);
settings.opnCore=conf.getInt("opnCore",1);
settings.opn1Core=conf.getInt("opn1Core",1);
settings.opnaCore=conf.getInt("opnaCore",1);
settings.opnbCore=conf.getInt("opnbCore",1);
settings.opl2Core=conf.getInt("opl2Core",0);
settings.opl3Core=conf.getInt("opl3Core",0);
settings.esfmCore=conf.getInt("esfmCore",0);
@ -4363,7 +4388,9 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.fdsCoreRender=conf.getInt("fdsCoreRender",1);
settings.c64CoreRender=conf.getInt("c64CoreRender",1);
settings.pokeyCoreRender=conf.getInt("pokeyCoreRender",1);
settings.opnCoreRender=conf.getInt("opnCoreRender",1);
settings.opn1CoreRender=conf.getInt("opn1CoreRender",1);
settings.opnaCoreRender=conf.getInt("opnaCoreRender",1);
settings.opnbCoreRender=conf.getInt("opnbCoreRender",1);
settings.opl2CoreRender=conf.getInt("opl2CoreRender",0);
settings.opl3CoreRender=conf.getInt("opl3CoreRender",0);
settings.esfmCoreRender=conf.getInt("esfmCoreRender",0);
@ -4405,7 +4432,9 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.fdsCore,0,1);
clampSetting(settings.c64Core,0,2);
clampSetting(settings.pokeyCore,0,1);
clampSetting(settings.opnCore,0,1);
clampSetting(settings.opn1Core,0,2);
clampSetting(settings.opnaCore,0,2);
clampSetting(settings.opnbCore,0,2);
clampSetting(settings.opl2Core,0,2);
clampSetting(settings.opl3Core,0,2);
clampSetting(settings.esfmCore,0,1);
@ -4428,7 +4457,9 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.fdsCoreRender,0,1);
clampSetting(settings.c64CoreRender,0,2);
clampSetting(settings.pokeyCoreRender,0,1);
clampSetting(settings.opnCoreRender,0,1);
clampSetting(settings.opn1CoreRender,0,2);
clampSetting(settings.opnaCoreRender,0,2);
clampSetting(settings.opnbCoreRender,0,2);
clampSetting(settings.opl2CoreRender,0,2);
clampSetting(settings.opl3CoreRender,0,2);
clampSetting(settings.esfmCoreRender,0,1);
@ -4882,7 +4913,9 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("fdsCore",settings.fdsCore);
conf.set("c64Core",settings.c64Core);
conf.set("pokeyCore",settings.pokeyCore);
conf.set("opnCore",settings.opnCore);
conf.set("opn1Core",settings.opn1Core);
conf.set("opnaCore",settings.opnaCore);
conf.set("opnbCore",settings.opnbCore);
conf.set("opl2Core",settings.opl2Core);
conf.set("opl3Core",settings.opl3Core);
conf.set("esfmCore",settings.esfmCore);
@ -4907,7 +4940,9 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("fdsCoreRender",settings.fdsCoreRender);
conf.set("c64CoreRender",settings.c64CoreRender);
conf.set("pokeyCoreRender",settings.pokeyCoreRender);
conf.set("opnCoreRender",settings.opnCoreRender);
conf.set("opn1CoreRender",settings.opn1CoreRender);
conf.set("opnaCoreRender",settings.opnaCoreRender);
conf.set("opnbCoreRender",settings.opnbCoreRender);
conf.set("opl2CoreRender",settings.opl2CoreRender);
conf.set("opl3CoreRender",settings.opl3CoreRender);
conf.set("esfmCoreRender",settings.esfmCoreRender);
@ -4965,7 +5000,9 @@ void FurnaceGUI::commitSettings() {
settings.fdsCore!=e->getConfInt("fdsCore",0) ||
settings.c64Core!=e->getConfInt("c64Core",0) ||
settings.pokeyCore!=e->getConfInt("pokeyCore",1) ||
settings.opnCore!=e->getConfInt("opnCore",1) ||
settings.opn1Core!=e->getConfInt("opn1Core",1) ||
settings.opnaCore!=e->getConfInt("opnaCore",1) ||
settings.opnbCore!=e->getConfInt("opnbCore",1) ||
settings.opl2Core!=e->getConfInt("opl2Core",0) ||
settings.opl3Core!=e->getConfInt("opl3Core",0) ||
settings.esfmCore!=e->getConfInt("esfmCore",0) ||