PCE: implement noise, wave and pan commands

TODO: actually implement noise mode very well
This commit is contained in:
tildearrow 2021-06-08 20:45:38 -05:00
parent 8dffdca25a
commit 8b9da366e4
3 changed files with 19 additions and 16 deletions

View file

@ -62,10 +62,6 @@ void DivPlatformPCE::tick() {
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }
} }
if (chan[i].std.hadDuty) {
chan[i].duty=chan[i].std.duty;
//DivInstrument* ins=parent->getIns(chan[i].ins);
}
if (chan[i].std.hadWave) { if (chan[i].std.hadWave) {
if (chan[i].wave!=chan[i].std.wave) { if (chan[i].wave!=chan[i].std.wave) {
chan[i].wave=chan[i].std.wave; chan[i].wave=chan[i].std.wave;
@ -167,17 +163,12 @@ int DivPlatformPCE::dispatch(DivCommand c) {
break; break;
} }
case DIV_CMD_STD_NOISE_MODE: case DIV_CMD_STD_NOISE_MODE:
chan[c.chan].duty=c.value; chan[c.chan].noise=c.value;
if (c.chan!=2) { chWrite(c.chan,0x07,chan[c.chan].noise?0x80:0);
chan[c.chan].freqChanged=true;
// TODO
}
break; break;
case DIV_CMD_PANNING: { case DIV_CMD_PANNING: {
lastPan&=~(0x11<<c.chan); chan[c.chan].pan=c.value;
if (c.value==0) c.value=0x11; chWrite(c.chan,0x05,chan[c.chan].pan);
lastPan|=c.value<<c.chan;
//rWrite(0x25,lastPan);
break; break;
} }
case DIV_CMD_LEGATO: case DIV_CMD_LEGATO:

View file

@ -9,8 +9,8 @@
class DivPlatformPCE: public DivDispatch { class DivPlatformPCE: public DivDispatch {
struct Channel { struct Channel {
int freq, baseFreq, pitch; int freq, baseFreq, pitch;
unsigned char ins, note, duty, pan; unsigned char ins, note, pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta; bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise;
signed char vol, outVol, wave; signed char vol, outVol, wave;
DivMacroInt std; DivMacroInt std;
Channel(): Channel():
@ -19,7 +19,6 @@ class DivPlatformPCE: public DivDispatch {
pitch(0), pitch(0),
ins(-1), ins(-1),
note(0), note(0),
duty(0),
pan(255), pan(255),
active(false), active(false),
insChanged(true), insChanged(true),
@ -27,6 +26,7 @@ class DivPlatformPCE: public DivDispatch {
keyOn(false), keyOn(false),
keyOff(false), keyOff(false),
inPorta(false), inPorta(false),
noise(false),
vol(31), vol(31),
outVol(31), outVol(31),
wave(-1) {} wave(-1) {}

View file

@ -109,6 +109,18 @@ bool DivEngine::perSystemEffect(int ch, unsigned char effect, unsigned char effe
return false; return false;
} }
break; break;
case DIV_SYSTEM_PCE:
switch (effect) {
case 0x10: // select waveform
dispatchCmd(DivCommand(DIV_CMD_WAVE,ch,effectVal));
break;
case 0x11: // noise mode
dispatchCmd(DivCommand(DIV_CMD_STD_NOISE_MODE,ch,effectVal));
break;
default:
return false;
}
break;
default: default:
return false; return false;
} }