mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 06:01:29 +00:00
Merge pull request #827 from tildearrow/opn_volbalance
Add SSG and FM/ADPCM volume mixer config for OPN/A/B
This commit is contained in:
commit
e32a8dda8f
7 changed files with 79 additions and 14 deletions
|
@ -154,6 +154,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
|||
unsigned int ayDiv;
|
||||
unsigned char csmChan;
|
||||
unsigned char lfoValue;
|
||||
unsigned short ssgVol;
|
||||
unsigned short fmVol;
|
||||
bool extSys, useCombo, fbAllOps;
|
||||
|
||||
DivConfig ayFlags;
|
||||
|
@ -172,6 +174,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
|||
ayDiv(a),
|
||||
csmChan(cc),
|
||||
lfoValue(0),
|
||||
ssgVol(128),
|
||||
fmVol(256),
|
||||
extSys(isExtSys),
|
||||
useCombo(false),
|
||||
fbAllOps(false) {}
|
||||
|
|
|
@ -210,11 +210,12 @@ void DivPlatformYM2203::acquire_combo(short** buf, size_t len) {
|
|||
);
|
||||
|
||||
os&=~3;
|
||||
os=(os*fmVol)>>8;
|
||||
|
||||
// ymfm part
|
||||
fm->generate(&fmout);
|
||||
|
||||
os+=((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1);
|
||||
os+=((fmout.data[1]+fmout.data[2]+fmout.data[3])*ssgVol)>>8;
|
||||
if (os<-32768) os=-32768;
|
||||
if (os>32767) os=32767;
|
||||
|
||||
|
@ -255,7 +256,7 @@ void DivPlatformYM2203::acquire_ymfm(short** buf, size_t len) {
|
|||
|
||||
fm->generate(&fmout);
|
||||
|
||||
os=fmout.data[0]+((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1);
|
||||
os=((fmout.data[0]*fmVol)>>8)+(((fmout.data[1]+fmout.data[2]+fmout.data[3])*ssgVol)>>8);
|
||||
if (os<-32768) os=-32768;
|
||||
if (os>32767) os=32767;
|
||||
|
||||
|
@ -1074,6 +1075,8 @@ void DivPlatformYM2203::setFlags(const DivConfig& flags) {
|
|||
CHECK_CUSTOM_CLOCK;
|
||||
noExtMacros=flags.getBool("noExtMacros",false);
|
||||
fbAllOps=flags.getBool("fbAllOps",false);
|
||||
ssgVol=flags.getInt("ssgVol",128);
|
||||
fmVol=flags.getInt("fmVol",256);
|
||||
rate=fm->sample_rate(chipClock);
|
||||
for (int i=0; i<6; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
|
|
|
@ -374,15 +374,17 @@ void DivPlatformYM2608::acquire_combo(short** buf, size_t len) {
|
|||
|
||||
os[0]>>=1;
|
||||
os[1]>>=1;
|
||||
os[0]=(os[0]*fmVol)>>8;
|
||||
os[1]=(os[1]*fmVol)>>8;
|
||||
|
||||
// ymfm part
|
||||
fm->generate(&fmout);
|
||||
|
||||
os[0]+=fmout.data[0]+(fmout.data[2]>>1);
|
||||
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[0]<-32768) os[0]=-32768;
|
||||
if (os[0]>32767) os[0]=32767;
|
||||
|
||||
os[1]+=fmout.data[1]+(fmout.data[2]>>1);
|
||||
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[1]<-32768) os[1]=-32768;
|
||||
if (os[1]>32767) os[1]=32767;
|
||||
|
||||
|
@ -439,11 +441,11 @@ void DivPlatformYM2608::acquire_ymfm(short** buf, size_t len) {
|
|||
|
||||
fm->generate(&fmout);
|
||||
|
||||
os[0]=fmout.data[0]+(fmout.data[2]>>1);
|
||||
os[0]=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[0]<-32768) os[0]=-32768;
|
||||
if (os[0]>32767) os[0]=32767;
|
||||
|
||||
os[1]=fmout.data[1]+(fmout.data[2]>>1);
|
||||
os[1]=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[1]<-32768) os[1]=-32768;
|
||||
if (os[1]>32767) os[1]=32767;
|
||||
|
||||
|
@ -1603,6 +1605,8 @@ void DivPlatformYM2608::setFlags(const DivConfig& flags) {
|
|||
CHECK_CUSTOM_CLOCK;
|
||||
noExtMacros=flags.getBool("noExtMacros",false);
|
||||
fbAllOps=flags.getBool("fbAllOps",false);
|
||||
ssgVol=flags.getInt("ssgVol",128);
|
||||
fmVol=flags.getInt("fmVol",256);
|
||||
rate=fm->sample_rate(chipClock);
|
||||
for (int i=0; i<16; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
|
|
|
@ -305,15 +305,17 @@ void DivPlatformYM2610::acquire_combo(short** buf, size_t len) {
|
|||
|
||||
os[0]>>=1;
|
||||
os[1]>>=1;
|
||||
os[0]=(os[0]*fmVol)>>8;
|
||||
os[1]=(os[1]*fmVol)>>8;
|
||||
|
||||
// ymfm part
|
||||
fm->generate(&fmout);
|
||||
|
||||
os[0]+=fmout.data[0]+(fmout.data[2]>>1);
|
||||
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[0]<-32768) os[0]=-32768;
|
||||
if (os[0]>32767) os[0]=32767;
|
||||
|
||||
os[1]+=fmout.data[1]+(fmout.data[2]>>1);
|
||||
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[1]<-32768) os[1]=-32768;
|
||||
if (os[1]>32767) os[1]=32767;
|
||||
|
||||
|
@ -372,11 +374,11 @@ void DivPlatformYM2610::acquire_ymfm(short** buf, size_t len) {
|
|||
|
||||
fm->generate(&fmout);
|
||||
|
||||
os[0]=fmout.data[0]+(fmout.data[2]>>1);
|
||||
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[0]<-32768) os[0]=-32768;
|
||||
if (os[0]>32767) os[0]=32767;
|
||||
|
||||
os[1]=fmout.data[1]+(fmout.data[2]>>1);
|
||||
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[1]<-32768) os[1]=-32768;
|
||||
if (os[1]>32767) os[1]=32767;
|
||||
|
||||
|
|
|
@ -373,15 +373,17 @@ void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) {
|
|||
|
||||
os[0]>>=1;
|
||||
os[1]>>=1;
|
||||
os[0]=(os[0]*fmVol)>>8;
|
||||
os[1]=(os[1]*fmVol)>>8;
|
||||
|
||||
// ymfm part
|
||||
fm->generate(&fmout);
|
||||
|
||||
os[0]+=fmout.data[0]+(fmout.data[2]>>1);
|
||||
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[0]<-32768) os[0]=-32768;
|
||||
if (os[0]>32767) os[0]=32767;
|
||||
|
||||
os[1]+=fmout.data[1]+(fmout.data[2]>>1);
|
||||
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[1]<-32768) os[1]=-32768;
|
||||
if (os[1]>32767) os[1]=32767;
|
||||
|
||||
|
@ -438,11 +440,11 @@ void DivPlatformYM2610B::acquire_ymfm(short** buf, size_t len) {
|
|||
|
||||
fm->generate(&fmout);
|
||||
|
||||
os[0]=fmout.data[0]+(fmout.data[2]>>1);
|
||||
os[0]+=((fmout.data[0]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[0]<-32768) os[0]=-32768;
|
||||
if (os[0]>32767) os[0]=32767;
|
||||
|
||||
os[1]=fmout.data[1]+(fmout.data[2]>>1);
|
||||
os[1]+=((fmout.data[1]*fmVol)>>8)+((fmout.data[2]*ssgVol)>>8);
|
||||
if (os[1]<-32768) os[1]=-32768;
|
||||
if (os[1]>32767) os[1]=32767;
|
||||
|
||||
|
|
|
@ -222,6 +222,8 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
|
|||
CHECK_CUSTOM_CLOCK;
|
||||
noExtMacros=flags.getBool("noExtMacros",false);
|
||||
fbAllOps=flags.getBool("fbAllOps",false);
|
||||
ssgVol=flags.getInt("ssgVol",128);
|
||||
fmVol=flags.getInt("fmVol",256);
|
||||
rate=fm->sample_rate(chipClock);
|
||||
for (int i=0; i<16; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
|
|
|
@ -472,6 +472,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
int clockSel=flags.getInt("clockSel",0);
|
||||
bool noExtMacros=flags.getBool("noExtMacros",false);
|
||||
bool fbAllOps=flags.getBool("fbAllOps",false);
|
||||
int ssgVol=flags.getInt("ssgVol",128);
|
||||
int fmVol=flags.getInt("fmVol",256);
|
||||
|
||||
if (ImGui::RadioButton("8MHz (Neo Geo MVS)",clockSel==0)) {
|
||||
clockSel=0;
|
||||
|
@ -491,11 +493,25 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
}
|
||||
}
|
||||
|
||||
if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
|
||||
if (ssgVol<0) ssgVol=0;
|
||||
if (ssgVol>256) ssgVol=256;
|
||||
altered=true;
|
||||
} rightClickable
|
||||
|
||||
if (CWSliderInt("FM/ADPCM Volume",&fmVol,0,256)) {
|
||||
if (fmVol<0) fmVol=0;
|
||||
if (fmVol>256) fmVol=256;
|
||||
altered=true;
|
||||
} rightClickable
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
flags.set("clockSel",clockSel);
|
||||
flags.set("noExtMacros",noExtMacros);
|
||||
flags.set("fbAllOps",fbAllOps);
|
||||
flags.set("ssgVol",ssgVol);
|
||||
flags.set("fmVol",fmVol);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
@ -854,6 +870,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
int prescale=flags.getInt("prescale",0);
|
||||
bool noExtMacros=flags.getBool("noExtMacros",false);
|
||||
bool fbAllOps=flags.getBool("fbAllOps",false);
|
||||
int ssgVol=flags.getInt("ssgVol",128);
|
||||
int fmVol=flags.getInt("fmVol",256);
|
||||
|
||||
ImGui::Text("Clock rate:");
|
||||
if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) {
|
||||
|
@ -894,6 +912,18 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
altered=true;
|
||||
}
|
||||
|
||||
if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
|
||||
if (ssgVol<0) ssgVol=0;
|
||||
if (ssgVol>256) ssgVol=256;
|
||||
altered=true;
|
||||
} rightClickable
|
||||
|
||||
if (CWSliderInt("FM Volume",&fmVol,0,256)) {
|
||||
if (fmVol<0) fmVol=0;
|
||||
if (fmVol>256) fmVol=256;
|
||||
altered=true;
|
||||
} rightClickable
|
||||
|
||||
if (type==DIV_SYSTEM_YM2203_EXT || type==DIV_SYSTEM_YM2203_CSM) {
|
||||
if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) {
|
||||
altered=true;
|
||||
|
@ -909,6 +939,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
flags.set("prescale",prescale);
|
||||
flags.set("noExtMacros",noExtMacros);
|
||||
flags.set("fbAllOps",fbAllOps);
|
||||
flags.set("ssgVol",ssgVol);
|
||||
flags.set("fmVol",fmVol);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
@ -920,6 +952,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
int prescale=flags.getInt("prescale",0);
|
||||
bool noExtMacros=flags.getBool("noExtMacros",false);
|
||||
bool fbAllOps=flags.getBool("fbAllOps",false);
|
||||
int ssgVol=flags.getInt("ssgVol",128);
|
||||
int fmVol=flags.getInt("fmVol",256);
|
||||
|
||||
ImGui::Text("Clock rate:");
|
||||
if (ImGui::RadioButton("8MHz (Arcade)",clockSel==0)) {
|
||||
|
@ -944,6 +978,18 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
altered=true;
|
||||
}
|
||||
|
||||
if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
|
||||
if (ssgVol<0) ssgVol=0;
|
||||
if (ssgVol>256) ssgVol=256;
|
||||
altered=true;
|
||||
} rightClickable
|
||||
|
||||
if (CWSliderInt("FM/ADPCM Volume",&fmVol,0,256)) {
|
||||
if (fmVol<0) fmVol=0;
|
||||
if (fmVol>256) fmVol=256;
|
||||
altered=true;
|
||||
} rightClickable
|
||||
|
||||
if (type==DIV_SYSTEM_YM2608_EXT || type==DIV_SYSTEM_YM2608_CSM) {
|
||||
if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) {
|
||||
altered=true;
|
||||
|
@ -959,6 +1005,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
flags.set("prescale",prescale);
|
||||
flags.set("noExtMacros",noExtMacros);
|
||||
flags.set("fbAllOps",fbAllOps);
|
||||
flags.set("ssgVol",ssgVol);
|
||||
flags.set("fmVol",fmVol);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue