PCE: remove some sample playback clicking

This commit is contained in:
tildearrow 2022-08-06 00:34:28 -05:00
parent 3e70ed6d3e
commit 6ec9cceb09
2 changed files with 10 additions and 2 deletions

View file

@ -133,6 +133,10 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len)
}
void DivPlatformPCE::updateWave(int ch) {
if (chan[ch].pcm) {
chan[ch].deferredWaveUpdate=true;
return;
}
chWrite(ch,0x04,0x5f);
chWrite(ch,0x04,0x1f);
for (int i=0; i<32; i++) {
@ -142,6 +146,9 @@ void DivPlatformPCE::updateWave(int ch) {
if (chan[ch].active) {
chWrite(ch,0x04,0x80|chan[ch].outVol);
}
if (chan[ch].deferredWaveUpdate) {
chan[ch].deferredWaveUpdate=false;
}
}
// TODO: in octave 6 the noise table changes to a tonal one
@ -227,7 +234,7 @@ void DivPlatformPCE::tick(bool sysTick) {
chan[i].freqChanged=true;
}
if (chan[i].active) {
if (chan[i].ws.tick() || (chan[i].std.phaseReset.had && chan[i].std.phaseReset.val==1)) {
if (chan[i].ws.tick() || (chan[i].std.phaseReset.had && chan[i].std.phaseReset.val==1) || chan[i].deferredWaveUpdate) {
updateWave(i);
}
}

View file

@ -33,7 +33,7 @@ class DivPlatformPCE: public DivDispatch {
unsigned int dacPos;
int dacSample, ins;
unsigned char pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise, pcm, furnaceDac;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise, pcm, furnaceDac, deferredWaveUpdate;
signed char vol, outVol, wave;
DivMacroInt std;
DivWaveSynth ws;
@ -64,6 +64,7 @@ class DivPlatformPCE: public DivDispatch {
noise(false),
pcm(false),
furnaceDac(false),
deferredWaveUpdate(false),
vol(31),
outVol(31),
wave(-1) {}