Game Boy: add an option to select wave ch invert

This commit is contained in:
tildearrow 2023-05-04 02:18:56 -05:00
parent bf95a358bc
commit 1e5163c738
3 changed files with 30 additions and 2 deletions

View File

@ -82,8 +82,12 @@ void DivPlatformGB::acquire(short** buf, size_t len) {
void DivPlatformGB::updateWave() { void DivPlatformGB::updateWave() {
rWrite(0x1a,0); rWrite(0x1a,0);
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
int nibble1=15-ws.output[((i<<1)+antiClickWavePos)&31]; int nibble1=ws.output[((i<<1)+antiClickWavePos)&31];
int nibble2=15-ws.output[((1+(i<<1))+antiClickWavePos)&31]; int nibble2=ws.output[((1+(i<<1))+antiClickWavePos)&31];
if (invertWave) {
nibble1^=15;
nibble2^=15;
}
rWrite(0x30+i,(nibble1<<4)|nibble2); rWrite(0x30+i,(nibble1<<4)|nibble2);
} }
antiClickWavePos&=31; antiClickWavePos&=31;
@ -658,6 +662,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) {
model=GB_MODEL_AGB; model=GB_MODEL_AGB;
break; break;
} }
invertWave=flags.getBool("invertWave",true);
enoughAlready=flags.getBool("enoughAlready",false); enoughAlready=flags.getBool("enoughAlready",false);
} }

View File

@ -57,6 +57,7 @@ class DivPlatformGB: public DivDispatch {
DivDispatchOscBuffer* oscBuf[4]; DivDispatchOscBuffer* oscBuf[4];
bool isMuted[4]; bool isMuted[4];
bool antiClickEnabled; bool antiClickEnabled;
bool invertWave;
bool enoughAlready; bool enoughAlready;
unsigned char lastPan; unsigned char lastPan;
DivWaveSynth ws; DivWaveSynth ws;

View File

@ -310,6 +310,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_GB: { case DIV_SYSTEM_GB: {
int chipType=flags.getInt("chipType",0); int chipType=flags.getInt("chipType",0);
bool noAntiClick=flags.getBool("noAntiClick",false); bool noAntiClick=flags.getBool("noAntiClick",false);
bool invertWave=flags.getBool("invertWave",true);
bool enoughAlready=flags.getBool("enoughAlready",false); bool enoughAlready=flags.getBool("enoughAlready",false);
if (ImGui::Checkbox("Disable anti-click",&noAntiClick)) { if (ImGui::Checkbox("Disable anti-click",&noAntiClick)) {
@ -332,6 +333,26 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=3; chipType=3;
altered=true; altered=true;
} }
ImGui::Text("Wave channel orientation:");
if (chipType==3) {
if (ImGui::RadioButton("Normal",!invertWave)) {
invertWave=false;
altered=true;
}
if (ImGui::RadioButton("Inverted",invertWave)) {
invertWave=true;
altered=true;
}
} else {
if (ImGui::RadioButton("Exact data (inverted)",!invertWave)) {
invertWave=false;
altered=true;
}
if (ImGui::RadioButton("Exact output (normal)",invertWave)) {
invertWave=true;
altered=true;
}
}
if (ImGui::Checkbox("Pretty please one more compat flag when I use arpeggio and my sound length",&enoughAlready)) { if (ImGui::Checkbox("Pretty please one more compat flag when I use arpeggio and my sound length",&enoughAlready)) {
altered=true; altered=true;
} }
@ -340,6 +361,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
e->lockSave([&]() { e->lockSave([&]() {
flags.set("chipType",chipType); flags.set("chipType",chipType);
flags.set("noAntiClick",noAntiClick); flags.set("noAntiClick",noAntiClick);
flags.set("invertWave",invertWave);
flags.set("enoughAlready",enoughAlready); flags.set("enoughAlready",enoughAlready);
}); });
} }