Implement Phase Reset Timer macro for Sound Unit (#573)

* Implement Phase Reset Timer Macro

* And make the macro actually work

* Delete ex4Max variable
This commit is contained in:
Aleksi Knutsi 2022-07-24 07:13:30 +07:00 committed by GitHub
parent 623c0efbba
commit 8011e7adc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -187,6 +187,13 @@ void DivPlatformSoundUnit::tick(bool sysTick) {
chan[i].control=chan[i].std.ex3.val&15; chan[i].control=chan[i].std.ex3.val&15;
writeControl(i); writeControl(i);
} }
if (chan[i].std.ex4.had) {
chan[i].syncTimer=chan[i].std.ex4.val&65535;
chan[i].timerSync=(chan[i].syncTimer>0);
chWrite(i,0x1e,chan[i].syncTimer&0xff);
chWrite(i,0x1f,chan[i].syncTimer>>8);
writeControlUpper(i);
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SU); //DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SU);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);

View file

@ -3678,6 +3678,7 @@ void FurnaceGUI::drawInsEdit() {
} }
if (ins->type==DIV_INS_SU) { if (ins->type==DIV_INS_SU) {
macroList.push_back(FurnaceGUIMacroDesc("Control",&ins->std.ex3Macro,0,4,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,suControlBits)); macroList.push_back(FurnaceGUIMacroDesc("Control",&ins->std.ex3Macro,0,4,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,suControlBits));
macroList.push_back(FurnaceGUIMacroDesc("Phase Reset Timer",&ins->std.ex4Macro,0,65535,160,uiColors[GUI_COLOR_MACRO_OTHER])); // again reuse code from resonance macro but use ex4 instead
} }
drawMacros(macroList); drawMacros(macroList);