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);