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;
}
}
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].wave!=chan[i].std.wave) {
chan[i].wave=chan[i].std.wave;
@ -167,17 +163,12 @@ int DivPlatformPCE::dispatch(DivCommand c) {
break;
}
case DIV_CMD_STD_NOISE_MODE:
chan[c.chan].duty=c.value;
if (c.chan!=2) {
chan[c.chan].freqChanged=true;
// TODO
}
chan[c.chan].noise=c.value;
chWrite(c.chan,0x07,chan[c.chan].noise?0x80:0);
break;
case DIV_CMD_PANNING: {
lastPan&=~(0x11<<c.chan);
if (c.value==0) c.value=0x11;
lastPan|=c.value<<c.chan;
//rWrite(0x25,lastPan);
chan[c.chan].pan=c.value;
chWrite(c.chan,0x05,chan[c.chan].pan);
break;
}
case DIV_CMD_LEGATO:

View file

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

View file

@ -109,6 +109,18 @@ bool DivEngine::perSystemEffect(int ch, unsigned char effect, unsigned char effe
return false;
}
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:
return false;
}