Skip to content

Commit 3ea9f55

Browse files
committed
[SGU] Reset operator phases in FM preview for static window
1 parent e581d39 commit 3ea9f55

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/gui/fmPreview.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ void FurnaceGUI::renderFMPreviewSGU(const DivInstrumentFM& params, const DivInst
435435
int32_t outR=0;
436436
bool mult0=false;
437437

438+
const unsigned short chBase=0;
439+
const unsigned short opBase=chBase;
440+
const unsigned short chRegBase=chBase+(SGU_OP_PER_CH*SGU_OP_REGS);
441+
438442
if (pos==0) {
439443
SGU* sgu=(SGU*)fmPreviewSGU;
440444
SGU_Reset(sgu);
@@ -446,10 +450,6 @@ void FurnaceGUI::renderFMPreviewSGU(const DivInstrumentFM& params, const DivInst
446450
}
447451
}
448452

449-
const unsigned short chBase=0;
450-
const unsigned short opBase=chBase;
451-
const unsigned short chRegBase=chBase+(SGU_OP_PER_CH*SGU_OP_REGS);
452-
453453
bool hasSampleWave=false;
454454
for (int i=0; i<SGU_OP_PER_CH; i++) {
455455
const DivInstrumentFM::Operator& op=params.op[i];
@@ -544,6 +544,9 @@ void FurnaceGUI::renderFMPreviewSGU(const DivInstrumentFM& params, const DivInst
544544
SGU_WRITE(chRegBase+SGU1_CHN_FLAGS0,SGU1_FLAGS0_CTL_GATE);
545545
}
546546

547+
// reset operator phases each frame so the visible window is static
548+
SGU_WRITE(chRegBase+SGU1_CHN_FLAGS1,SGU1_FLAGS1_PHASE_RESET);
549+
547550
for (int i=0; i<FM_PREVIEW_SIZE; i++) {
548551
SGU_NextSample((SGU*)fmPreviewSGU,&outL,&outR);
549552
SGU_NextSample((SGU*)fmPreviewSGU,&outL,&outR);

0 commit comments

Comments
 (0)