From 7ac225e8399a0742878fcf05111cbd0b1e34b90f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 8 Dec 2021 18:29:50 -0500 Subject: [PATCH] arcade: even more work PCM tonight --- src/engine/dispatch.h | 1 + src/engine/platform/arcade.cpp | 18 +++--------------- src/engine/platform/arcade.h | 12 ++++++++++-- src/engine/playback.cpp | 1 + 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/engine/dispatch.h b/src/engine/dispatch.h index 27e88ba0a..1d8b4f6a8 100644 --- a/src/engine/dispatch.h +++ b/src/engine/dispatch.h @@ -20,6 +20,7 @@ enum DivDispatchCmds { DIV_CMD_PRE_NOTE, // used in C64 DIV_CMD_SAMPLE_MODE, + DIV_CMD_SAMPLE_FREQ, DIV_CMD_FM_LFO, DIV_CMD_FM_TL, diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index d63600e19..6553a2869 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -120,9 +120,9 @@ int DivPlatformArcade::dispatch(DivCommand c) { } if (chan[c.chan].insChanged) { rWrite(baseAddr+0x40,(op.mult&15)|(dtTable[op.dt&7]<<4)); - rWrite(baseAddr+0x80,(op.ar&31)); + rWrite(baseAddr+0x80,(op.ar&31)|(op.rs<<6)); rWrite(baseAddr+0xa0,(op.dr&31)|(op.am<<7)); - rWrite(baseAddr+0xc0,op.d2r&31); + rWrite(baseAddr+0xc0,(op.d2r&31)|(op.dt2<<6)); rWrite(baseAddr+0xe0,(op.rr&15)|(op.sl<<4)); } } @@ -167,19 +167,7 @@ int DivPlatformArcade::dispatch(DivCommand c) { chan[c.chan].ins=c.value; break; case DIV_CMD_PANNING: { - switch (c.value) { - case 0x01: - chan[c.chan].pan=1; - break; - case 0x10: - chan[c.chan].pan=2; - break; - default: - chan[c.chan].pan=3; - break; - } - DivInstrument* ins=parent->getIns(chan[c.chan].ins); - //rWrite(chanOffs[c.chan]+0xb4,(chan[c.chan].pan<<6)|(ins->fm.fms&7)|((ins->fm.ams&3)<<4)); + // TODO break; } case DIV_CMD_PITCH: { diff --git a/src/engine/platform/arcade.h b/src/engine/platform/arcade.h index 6091bbff2..00ab548e7 100644 --- a/src/engine/platform/arcade.h +++ b/src/engine/platform/arcade.h @@ -13,8 +13,16 @@ class DivPlatformArcade: public DivDispatch { signed char konCycles; bool active, insChanged, freqChanged, keyOn, keyOff, portaPause; int vol; - unsigned char pan; - Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), vol(0), pan(3) {} + unsigned char chVolL, chVolR; + + struct PCMChannel { + int sample; + unsigned int pos; // <<8 + unsigned short len; + unsigned char freq; + PCMChannel(): sample(-1), pos(0), len(0), freq(0) {} + } pcm; + Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), vol(0), chVolL(8), chVolR(8) {} }; Channel chan[13]; struct QueuedWrite { diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index ab111c2c1..fef14e3ac 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -30,6 +30,7 @@ const char* cmdName[DIV_CMD_MAX]={ "PRE_NOTE", "SAMPLE_MODE", + "SAMPLE_FREQ", "FM_LFO", "FM_TL",