PCE: more work

This commit is contained in:
tildearrow 2021-06-08 16:46:27 -05:00
parent 1379b4c935
commit 8dffdca25a
2 changed files with 18 additions and 5 deletions

View file

@ -11,7 +11,7 @@
} \
rWrite(a,v);
#define FREQ_BASE 1712.0f
#define FREQ_BASE 1712.0f*2
void DivPlatformPCE::acquire(int& l, int& r) {
while (!writes.empty()) {
@ -20,7 +20,7 @@ void DivPlatformPCE::acquire(int& l, int& r) {
writes.pop();
}
tempL=0; tempR=0;
pce->Update(2);
pce->Update(4);
pce->ResetTS(0);
//printf("tempL: %d tempR: %d\n",tempL,tempR);
@ -35,6 +35,9 @@ void DivPlatformPCE::updateWave(int ch) {
for (int i=0; i<32; i++) {
chWrite(ch,0x06,wt->data[i]&31);
}
if (chan[ch].active) {
chWrite(ch,0x04,0x80|chan[ch].outVol);
}
}
void DivPlatformPCE::tick() {
@ -103,6 +106,7 @@ int DivPlatformPCE::dispatch(DivCommand c) {
chan[c.chan].note=c.value;
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));
break;
case DIV_CMD_NOTE_OFF:
@ -116,11 +120,19 @@ int DivPlatformPCE::dispatch(DivCommand c) {
}
break;
case DIV_CMD_VOLUME:
if (chan[c.chan].vol!=c.value) {
chan[c.chan].vol=c.value;
//rWrite(16+c.chan*5+2,gbVolMap[chan[c.chan].vol]);
if (!chan[c.chan].std.hasVol) {
chan[c.chan].outVol=c.value;
chWrite(c.chan,0x04,0x80|chan[c.chan].outVol);
}
}
break;
case DIV_CMD_GET_VOLUME:
if (chan[c.chan].std.hasVol) {
return chan[c.chan].vol;
}
return chan[c.chan].outVol;
break;
case DIV_CMD_PITCH:
chan[c.chan].pitch=c.value;

View file

@ -28,6 +28,7 @@ class DivPlatformPCE: public DivDispatch {
keyOff(false),
inPorta(false),
vol(31),
outVol(31),
wave(-1) {}
};
Channel chan[6];