PC speaker: add option to reset phase on freq chan
ge some motherboards do so
This commit is contained in:
parent
8a14435b4a
commit
53c625354b
|
@ -373,6 +373,9 @@ void DivPlatformPCSpeaker::tick(bool sysTick) {
|
||||||
if (chan[i].keyOff) {
|
if (chan[i].keyOff) {
|
||||||
on=false;
|
on=false;
|
||||||
}
|
}
|
||||||
|
if (freq!=chan[i].freq && resetPhase) {
|
||||||
|
pos=0;
|
||||||
|
}
|
||||||
freq=chan[i].freq;
|
freq=chan[i].freq;
|
||||||
if (chan[i].keyOn) chan[i].keyOn=false;
|
if (chan[i].keyOn) chan[i].keyOn=false;
|
||||||
if (chan[i].keyOff) chan[i].keyOff=false;
|
if (chan[i].keyOff) chan[i].keyOff=false;
|
||||||
|
@ -610,6 +613,7 @@ void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
|
||||||
CHECK_CUSTOM_CLOCK;
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/PCSPKR_DIVIDER;
|
rate=chipClock/PCSPKR_DIVIDER;
|
||||||
speakerType=flags.getInt("speakerType",0)&3;
|
speakerType=flags.getInt("speakerType",0)&3;
|
||||||
|
resetPhase=flags.getBool("resetPhase",false);
|
||||||
oscBuf->rate=rate;
|
oscBuf->rate=rate;
|
||||||
|
|
||||||
switch (speakerType) {
|
switch (speakerType) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
FixedQueue<RealQueueVal,2048> realQueue;
|
FixedQueue<RealQueueVal,2048> realQueue;
|
||||||
std::mutex realQueueLock;
|
std::mutex realQueueLock;
|
||||||
bool isMuted[1];
|
bool isMuted[1];
|
||||||
bool on, flip, lastOn, realOutEnabled;
|
bool on, flip, lastOn, realOutEnabled, resetPhase;
|
||||||
int pos, speakerType, beepFD, realOutMethod;
|
int pos, speakerType, beepFD, realOutMethod;
|
||||||
float low, band;
|
float low, band;
|
||||||
float low2, high2, band2;
|
float low2, high2, band2;
|
||||||
|
|
|
@ -997,6 +997,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
||||||
case DIV_SYSTEM_PCSPKR: {
|
case DIV_SYSTEM_PCSPKR: {
|
||||||
int clockSel=flags.getInt("clockSel",0);
|
int clockSel=flags.getInt("clockSel",0);
|
||||||
int speakerType=flags.getInt("speakerType",0);
|
int speakerType=flags.getInt("speakerType",0);
|
||||||
|
bool resetPhase=flags.getBool("resetPhase",false);
|
||||||
|
|
||||||
ImGui::Text("Clock rate:");
|
ImGui::Text("Clock rate:");
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
|
@ -1034,10 +1035,15 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
||||||
}
|
}
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
|
|
||||||
|
if (ImGui::Checkbox("Reset phase on frequency change",&resetPhase)) {
|
||||||
|
altered=true;
|
||||||
|
}
|
||||||
|
|
||||||
if (altered) {
|
if (altered) {
|
||||||
e->lockSave([&]() {
|
e->lockSave([&]() {
|
||||||
flags.set("clockSel",clockSel);
|
flags.set("clockSel",clockSel);
|
||||||
flags.set("speakerType",speakerType);
|
flags.set("speakerType",speakerType);
|
||||||
|
flags.set("resetPhase",resetPhase);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue