PC speaker: add PC-98 clock rate options

This commit is contained in:
tildearrow 2022-11-10 04:48:15 -05:00
parent 3f2f8a7197
commit 69bb628a8b
2 changed files with 27 additions and 1 deletions

View File

@ -587,7 +587,17 @@ bool DivPlatformPCSpeaker::keyOffAffectsArp(int ch) {
}
void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC/3.0;
switch (flags.getInt("clockSel",0)) {
case 1: // PC-98
chipClock=38400*52;
break;
case 2: // PC-98
chipClock=38400*64;
break;
default: // IBM PC
chipClock=COLOR_NTSC/3.0;
break;
}
rate=chipClock/PCSPKR_DIVIDER;
speakerType=flags.getInt("speakerType",0)&3;
oscBuf->rate=rate;

View File

@ -683,8 +683,23 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
break;
}
case DIV_SYSTEM_PCSPKR: {
int clockSel=flags.getInt("clockSel",0);
int speakerType=flags.getInt("speakerType",0);
ImGui::Text("Clock rate:");
if (ImGui::RadioButton("1.19MHz (PC)",clockSel==0)) {
clockSel=0;
altered=true;
}
if (ImGui::RadioButton("1.99MHz (PC-98)",clockSel==1)) {
clockSel=1;
altered=true;
}
if (ImGui::RadioButton("2.46MHz (PC-98)",clockSel==2)) {
clockSel=2;
altered=true;
}
ImGui::Text("Speaker type:");
if (ImGui::RadioButton("Unfiltered",speakerType==0)) {
speakerType=0;
@ -705,6 +720,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
if (altered) {
e->lockSave([&]() {
flags.set("clockSel",clockSel);
flags.set("speakerType",speakerType);
});
}