Replace divider to shift

This commit is contained in:
cam900 2023-01-14 11:55:40 +09:00
parent a8e388091a
commit fcc5b6e5eb
7 changed files with 49 additions and 49 deletions

View File

@ -154,8 +154,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
unsigned int ayDiv; unsigned int ayDiv;
unsigned char csmChan; unsigned char csmChan;
unsigned char lfoValue; unsigned char lfoValue;
unsigned char ssgVol; unsigned short ssgVol;
unsigned char fmVol; unsigned short fmVol;
bool extSys, useCombo, fbAllOps; bool extSys, useCombo, fbAllOps;
DivConfig ayFlags; DivConfig ayFlags;
@ -174,8 +174,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
ayDiv(a), ayDiv(a),
csmChan(cc), csmChan(cc),
lfoValue(0), lfoValue(0),
ssgVol(255), ssgVol(256),
fmVol(255), fmVol(256),
extSys(isExtSys), extSys(isExtSys),
useCombo(false), useCombo(false),
fbAllOps(false) {} fbAllOps(false) {}

View File

@ -210,12 +210,12 @@ void DivPlatformYM2203::acquire_combo(short** buf, size_t len) {
); );
os&=~3; os&=~3;
os=(os*fmVol)/255; os=(os*fmVol)>>8;
// ymfm part // ymfm part
fm->generate(&fmout); fm->generate(&fmout);
os+=(((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1)*ssgVol)/255; os+=(((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1)*ssgVol)>>8;
if (os<-32768) os=-32768; if (os<-32768) os=-32768;
if (os>32767) os=32767; if (os>32767) os=32767;
@ -256,7 +256,7 @@ void DivPlatformYM2203::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout); fm->generate(&fmout);
os=((fmout.data[0]*fmVol)/255)+((((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1)*ssgVol)/255); os=((fmout.data[0]*fmVol)>>8)+((((fmout.data[1]+fmout.data[2]+fmout.data[3])>>1)*ssgVol)>>8);
if (os<-32768) os=-32768; if (os<-32768) os=-32768;
if (os>32767) os=32767; if (os>32767) os=32767;
@ -1043,8 +1043,8 @@ void DivPlatformYM2203::setFlags(const DivConfig& flags) {
CHECK_CUSTOM_CLOCK; CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false); noExtMacros=flags.getBool("noExtMacros",false);
fbAllOps=flags.getBool("fbAllOps",false); fbAllOps=flags.getBool("fbAllOps",false);
ssgVol=flags.getInt("ssgVol",255); ssgVol=flags.getInt("ssgVol",256);
fmVol=flags.getInt("fmVol",255); fmVol=flags.getInt("fmVol",256);
rate=fm->sample_rate(chipClock); rate=fm->sample_rate(chipClock);
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;

View File

@ -374,17 +374,17 @@ void DivPlatformYM2608::acquire_combo(short** buf, size_t len) {
os[0]>>=1; os[0]>>=1;
os[1]>>=1; os[1]>>=1;
os[0]=(os[0]*fmVol)/255; os[0]=(os[0]*fmVol)>>8;
os[1]=(os[1]*fmVol)/255; os[1]=(os[1]*fmVol)>>8;
// ymfm part // ymfm part
fm->generate(&fmout); fm->generate(&fmout);
os[0]+=((fmout.data[0]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[0]+=((fmout.data[0]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767; if (os[0]>32767) os[0]=32767;
os[1]+=((fmout.data[1]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[1]+=((fmout.data[1]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768; if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767; if (os[1]>32767) os[1]=32767;
@ -441,11 +441,11 @@ void DivPlatformYM2608::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout); fm->generate(&fmout);
os[0]=((fmout.data[0]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[0]=((fmout.data[0]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767; if (os[0]>32767) os[0]=32767;
os[1]=((fmout.data[1]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[1]=((fmout.data[1]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768; if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767; if (os[1]>32767) os[1]=32767;
@ -1552,8 +1552,8 @@ void DivPlatformYM2608::setFlags(const DivConfig& flags) {
CHECK_CUSTOM_CLOCK; CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false); noExtMacros=flags.getBool("noExtMacros",false);
fbAllOps=flags.getBool("fbAllOps",false); fbAllOps=flags.getBool("fbAllOps",false);
ssgVol=flags.getInt("ssgVol",255); ssgVol=flags.getInt("ssgVol",256);
fmVol=flags.getInt("fmVol",255); fmVol=flags.getInt("fmVol",256);
rate=fm->sample_rate(chipClock); rate=fm->sample_rate(chipClock);
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;

View File

@ -305,17 +305,17 @@ void DivPlatformYM2610::acquire_combo(short** buf, size_t len) {
os[0]>>=1; os[0]>>=1;
os[1]>>=1; os[1]>>=1;
os[0]=(os[0]*fmVol)/255; os[0]=(os[0]*fmVol)>>8;
os[1]=(os[1]*fmVol)/255; os[1]=(os[1]*fmVol)>>8;
// ymfm part // ymfm part
fm->generate(&fmout); fm->generate(&fmout);
os[0]+=((fmout.data[0]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[0]+=((fmout.data[0]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767; if (os[0]>32767) os[0]=32767;
os[1]+=((fmout.data[1]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[1]+=((fmout.data[1]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768; if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767; if (os[1]>32767) os[1]=32767;
@ -374,11 +374,11 @@ void DivPlatformYM2610::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout); fm->generate(&fmout);
os[0]+=((fmout.data[0]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[0]+=((fmout.data[0]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767; if (os[0]>32767) os[0]=32767;
os[1]+=((fmout.data[1]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[1]+=((fmout.data[1]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768; if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767; if (os[1]>32767) os[1]=32767;

View File

@ -373,17 +373,17 @@ void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) {
os[0]>>=1; os[0]>>=1;
os[1]>>=1; os[1]>>=1;
os[0]=(os[0]*fmVol)/255; os[0]=(os[0]*fmVol)>>8;
os[1]=(os[1]*fmVol)/255; os[1]=(os[1]*fmVol)>>8;
// ymfm part // ymfm part
fm->generate(&fmout); fm->generate(&fmout);
os[0]+=((fmout.data[0]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[0]+=((fmout.data[0]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767; if (os[0]>32767) os[0]=32767;
os[1]+=((fmout.data[1]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[1]+=((fmout.data[1]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768; if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767; if (os[1]>32767) os[1]=32767;
@ -440,11 +440,11 @@ void DivPlatformYM2610B::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout); fm->generate(&fmout);
os[0]+=((fmout.data[0]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[0]+=((fmout.data[0]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767; if (os[0]>32767) os[0]=32767;
os[1]+=((fmout.data[1]*fmVol)/255)+(((fmout.data[2]>>1)*ssgVol)/255); os[1]+=((fmout.data[1]*fmVol)>>8)+(((fmout.data[2]>>1)*ssgVol)>>8);
if (os[1]<-32768) os[1]=-32768; if (os[1]<-32768) os[1]=-32768;
if (os[1]>32767) os[1]=32767; if (os[1]>32767) os[1]=32767;

View File

@ -222,8 +222,8 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
CHECK_CUSTOM_CLOCK; CHECK_CUSTOM_CLOCK;
noExtMacros=flags.getBool("noExtMacros",false); noExtMacros=flags.getBool("noExtMacros",false);
fbAllOps=flags.getBool("fbAllOps",false); fbAllOps=flags.getBool("fbAllOps",false);
ssgVol=flags.getInt("ssgVol",255); ssgVol=flags.getInt("ssgVol",256);
fmVol=flags.getInt("fmVol",255); fmVol=flags.getInt("fmVol",256);
rate=fm->sample_rate(chipClock); rate=fm->sample_rate(chipClock);
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;

View File

@ -472,8 +472,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0); int clockSel=flags.getInt("clockSel",0);
bool noExtMacros=flags.getBool("noExtMacros",false); bool noExtMacros=flags.getBool("noExtMacros",false);
bool fbAllOps=flags.getBool("fbAllOps",false); bool fbAllOps=flags.getBool("fbAllOps",false);
int ssgVol=flags.getInt("ssgVol",255); int ssgVol=flags.getInt("ssgVol",256);
int fmVol=flags.getInt("fmVol",255); int fmVol=flags.getInt("fmVol",256);
if (ImGui::RadioButton("8MHz (Neo Geo MVS)",clockSel==0)) { if (ImGui::RadioButton("8MHz (Neo Geo MVS)",clockSel==0)) {
clockSel=0; clockSel=0;
@ -493,15 +493,15 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
} }
} }
if (CWSliderInt("SSG Volume",&ssgVol,0,255)) { if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
if (ssgVol<0) ssgVol=0; if (ssgVol<0) ssgVol=0;
if (ssgVol>255) ssgVol=255; if (ssgVol>256) ssgVol=256;
altered=true; altered=true;
} rightClickable } rightClickable
if (CWSliderInt("FM/ADPCM Volume",&fmVol,0,255)) { if (CWSliderInt("FM/ADPCM Volume",&fmVol,0,256)) {
if (fmVol<0) fmVol=0; if (fmVol<0) fmVol=0;
if (fmVol>255) fmVol=255; if (fmVol>256) fmVol=256;
altered=true; altered=true;
} rightClickable } rightClickable
@ -870,8 +870,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int prescale=flags.getInt("prescale",0); int prescale=flags.getInt("prescale",0);
bool noExtMacros=flags.getBool("noExtMacros",false); bool noExtMacros=flags.getBool("noExtMacros",false);
bool fbAllOps=flags.getBool("fbAllOps",false); bool fbAllOps=flags.getBool("fbAllOps",false);
int ssgVol=flags.getInt("ssgVol",255); int ssgVol=flags.getInt("ssgVol",256);
int fmVol=flags.getInt("fmVol",255); int fmVol=flags.getInt("fmVol",256);
ImGui::Text("Clock rate:"); ImGui::Text("Clock rate:");
if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) { if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) {
@ -912,15 +912,15 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
altered=true; altered=true;
} }
if (CWSliderInt("SSG Volume",&ssgVol,0,255)) { if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
if (ssgVol<0) ssgVol=0; if (ssgVol<0) ssgVol=0;
if (ssgVol>255) ssgVol=255; if (ssgVol>256) ssgVol=256;
altered=true; altered=true;
} rightClickable } rightClickable
if (CWSliderInt("FM Volume",&fmVol,0,255)) { if (CWSliderInt("FM Volume",&fmVol,0,256)) {
if (fmVol<0) fmVol=0; if (fmVol<0) fmVol=0;
if (fmVol>255) fmVol=255; if (fmVol>256) fmVol=256;
altered=true; altered=true;
} rightClickable } rightClickable
@ -952,8 +952,8 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int prescale=flags.getInt("prescale",0); int prescale=flags.getInt("prescale",0);
bool noExtMacros=flags.getBool("noExtMacros",false); bool noExtMacros=flags.getBool("noExtMacros",false);
bool fbAllOps=flags.getBool("fbAllOps",false); bool fbAllOps=flags.getBool("fbAllOps",false);
int ssgVol=flags.getInt("ssgVol",255); int ssgVol=flags.getInt("ssgVol",256);
int fmVol=flags.getInt("fmVol",255); int fmVol=flags.getInt("fmVol",256);
ImGui::Text("Clock rate:"); ImGui::Text("Clock rate:");
if (ImGui::RadioButton("8MHz (Arcade)",clockSel==0)) { if (ImGui::RadioButton("8MHz (Arcade)",clockSel==0)) {
@ -978,15 +978,15 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
altered=true; altered=true;
} }
if (CWSliderInt("SSG Volume",&ssgVol,0,255)) { if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
if (ssgVol<0) ssgVol=0; if (ssgVol<0) ssgVol=0;
if (ssgVol>255) ssgVol=255; if (ssgVol>256) ssgVol=256;
altered=true; altered=true;
} rightClickable } rightClickable
if (CWSliderInt("FM/ADPCM Volume",&fmVol,0,255)) { if (CWSliderInt("FM/ADPCM Volume",&fmVol,0,256)) {
if (fmVol<0) fmVol=0; if (fmVol<0) fmVol=0;
if (fmVol>255) fmVol=255; if (fmVol>256) fmVol=256;
altered=true; altered=true;
} rightClickable } rightClickable