Add a 'set LFSR' macro and

remove the LFSR reset when a note is turned on
This commit is contained in:
scratchminer 2024-01-21 12:22:23 -05:00
parent 00676e785a
commit a8ee20c065
2 changed files with 17 additions and 17 deletions

View file

@ -101,6 +101,7 @@ void DivPlatformPowerNoise::acquire(short** buf, size_t len) {
* EX5 - tap B location (0-15) - noise only * EX5 - tap B location (0-15) - noise only
* EX6 - portion A offset (0-15) - slope only * EX6 - portion A offset (0-15) - slope only
* EX7 - portion B offset (0-15) - slope only * EX7 - portion B offset (0-15) - slope only
* EX8 - load LFSR (0-65535) - noise only
**/ **/
void DivPlatformPowerNoise::tick(bool sysTick) { void DivPlatformPowerNoise::tick(bool sysTick) {
@ -126,16 +127,21 @@ void DivPlatformPowerNoise::tick(bool sysTick) {
} }
} }
if (chan[i].std.ex2.had && chan[i].slope) { if (chan[i].std.ex2.had && chan[i].slope) {
cWrite(i, 0x03, chan[i].std.ex2.val) cWrite(i, 0x03, chan[i].std.ex2.val);
} }
if (chan[i].std.ex3.had && chan[i].slope) { if (chan[i].std.ex3.had && chan[i].slope) {
cWrite(i, 0x04, chan[i].std.ex3.val) cWrite(i, 0x04, chan[i].std.ex3.val);
} }
if ((chan[i].std.ex4.had || chan[i].std.ex5.had) && !chan[i].slope) { if ((chan[i].std.ex4.had || chan[i].std.ex5.had) && !chan[i].slope) {
cWrite(i, 0x05, (chan[i].std.ex4.val << 4) | chan[i].std.ex5.val) cWrite(i, 0x05, (chan[i].std.ex4.val << 4) | chan[i].std.ex5.val);
} }
if ((chan[i].std.ex6.had || chan[i].std.ex7.had) && chan[i].slope) { if ((chan[i].std.ex6.had || chan[i].std.ex7.had) && chan[i].slope) {
cWrite(i, 0x05, (chan[i].std.ex6.val << 4) | chan[i].std.ex7.val) cWrite(i, 0x05, (chan[i].std.ex6.val << 4) | chan[i].std.ex7.val);
}
if (chan[i].std.ex8.had && !chan[i].slope && chan[i].active && chan[i].std.phaseReset.had && chan[i].std.phaseReset.val==1) {
cWrite(i, 0x03, chan[i].std.ex8.val & 0xff);
cWrite(i, 0x04, chan[i].std.ex8.val >> 8);
chan[i].keyOn=true;
} }
if (chan[i].std.vol.had) { if (chan[i].std.vol.had) {
@ -167,11 +173,6 @@ void DivPlatformPowerNoise::tick(bool sysTick) {
cWrite(i, 0x00, slopeCtl(true, true, chan[i].slopeA, chan[i].slopeB)); cWrite(i, 0x00, slopeCtl(true, true, chan[i].slopeA, chan[i].slopeB));
chan[i].keyOn=true; chan[i].keyOn=true;
} }
else if (chan[i].active) {
cWrite(i, 0x03, 0x01);
cWrite(i, 0x04, 0x00);
chan[i].keyOn=true;
}
} }
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
@ -239,8 +240,6 @@ void DivPlatformPowerNoise::tick(bool sysTick) {
} }
else { else {
cWrite(i, 0x00, noiseCtl(true, chan[i].am, chan[i].tapBEnable)); cWrite(i, 0x00, noiseCtl(true, chan[i].am, chan[i].tapBEnable));
cWrite(i, 0x03, 0x01);
cWrite(i, 0x04, 0x00);
} }
} }
if (chan[i].keyOff) { if (chan[i].keyOff) {

View file

@ -7264,12 +7264,13 @@ void FurnaceGUI::drawInsEdit() {
} }
if (ins->type==DIV_INS_POWER_NOISE) { if (ins->type==DIV_INS_POWER_NOISE) {
macroList.push_back(FurnaceGUIMacroDesc("Control",&ins->std.ex1Macro,0,6,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true)); macroList.push_back(FurnaceGUIMacroDesc("Control",&ins->std.ex1Macro,0,6,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
macroList.push_back(FurnaceGUIMacroDesc("Portion A Length",&ins->std.ex2Macro,0,255,64,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Portion A Length",&ins->std.ex2Macro,0,255,128,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc("Portion B Length",&ins->std.ex3Macro,0,255,64,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Portion B Length",&ins->std.ex3Macro,0,255,128,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc("Tap A Location",&ins->std.ex4Macro,0,15,64,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Tap A Location",&ins->std.ex4Macro,0,15,96,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc("Tap B Location",&ins->std.ex5Macro,0,15,64,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Tap B Location",&ins->std.ex5Macro,0,15,96,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc("Portion A Offset",&ins->std.ex6Macro,0,15,64,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Portion A Offset",&ins->std.ex6Macro,0,15,96,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc("Portion B Offset",&ins->std.ex7Macro,0,15,64,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Portion B Offset",&ins->std.ex7Macro,0,15,96,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc("Load LFSR",&ins->std.ex8Macro,0,16,256,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
} }
drawMacros(macroList,macroEditStateMacros); drawMacros(macroList,macroEditStateMacros);