From 0b7772e76c31d789ffe8b53f8e076dae0ecab514 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 20 Jan 2022 16:33:20 -0500 Subject: [PATCH] PCE: allow sample preview --- src/engine/platform/pce.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index 11a934d5..447f5156 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -154,9 +154,14 @@ void DivPlatformPCE::tick() { int DivPlatformPCE::dispatch(DivCommand c) { switch (c.cmd) { - case DIV_CMD_NOTE_ON: + case DIV_CMD_NOTE_ON: { + DivInstrument* ins=parent->getIns(chan[c.chan].ins); + if (ins->type==DIV_INS_AMIGA) { + chan[c.chan].pcm=true; + } else if (chan[c.chan].furnaceDac) { + chan[c.chan].pcm=false; + } if (chan[c.chan].pcm) { - DivInstrument* ins=parent->getIns(chan[c.chan].ins); if (ins->type==DIV_INS_AMIGA) { chan[c.chan].dacSample=ins->amiga.initSample; if (chan[c.chan].dacSample<0 || chan[c.chan].dacSample>=parent->song.sampleLen) { @@ -195,8 +200,9 @@ int DivPlatformPCE::dispatch(DivCommand c) { chan[c.chan].active=true; chan[c.chan].keyOn=true; chWrite(c.chan,0x04,0x80|chan[c.chan].vol); - chan[c.chan].std.init(parent->getIns(chan[c.chan].ins)); + chan[c.chan].std.init(ins); break; + } case DIV_CMD_NOTE_OFF: chan[c.chan].dacSample=-1; chan[c.chan].pcm=false;