implement sample off for rest of chips except X1

This commit is contained in:
tildearrow 2024-04-24 03:45:59 -05:00
parent 84437bf0e3
commit 3989dffd58
12 changed files with 171 additions and 43 deletions

View file

@ -62,7 +62,7 @@ void DivPlatformPCE::acquire(short** buf, size_t len) {
chan[i].dacPeriod+=chan[i].dacRate;
if (chan[i].dacPeriod>rate) {
DivSample* s=parent->getSample(chan[i].dacSample);
if (s->samples<=0) {
if (s->samples<=0 || chan[i].dacPos>=s->samples) {
chan[i].dacSample=-1;
continue;
}
@ -204,7 +204,11 @@ void DivPlatformPCE::tick(bool sysTick) {
if (chan[i].std.phaseReset.had && chan[i].std.phaseReset.val==1) {
if (chan[i].furnaceDac && chan[i].pcm) {
if (chan[i].active && chan[i].dacSample>=0 && chan[i].dacSample<parent->song.sampleLen) {
chan[i].dacPos=0;
if (chan[i].setPos) {
chan[i].setPos=false;
} else {
chan[i].dacPos=0;
}
chan[i].dacPeriod=0;
chWrite(i,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[i].vol));
addWrite(0xffff0000+(i<<8),chan[i].dacSample);
@ -302,7 +306,11 @@ int DivPlatformPCE::dispatch(DivCommand c) {
addWrite(0xffff0000+(c.chan<<8),chan[c.chan].dacSample);
}
}
chan[c.chan].dacPos=0;
if (chan[c.chan].setPos) {
chan[c.chan].setPos=false;
} else {
chan[c.chan].dacPos=0;
}
chan[c.chan].dacPeriod=0;
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
@ -331,7 +339,11 @@ int DivPlatformPCE::dispatch(DivCommand c) {
} else {
if (dumpWrites) addWrite(0xffff0000+(c.chan<<8),chan[c.chan].dacSample);
}
chan[c.chan].dacPos=0;
if (chan[c.chan].setPos) {
chan[c.chan].setPos=false;
} else {
chan[c.chan].dacPos=0;
}
chan[c.chan].dacPeriod=0;
chan[c.chan].dacRate=parent->getSample(chan[c.chan].dacSample)->rate;
if (dumpWrites) {
@ -457,6 +469,10 @@ int DivPlatformPCE::dispatch(DivCommand c) {
sampleBank=parent->song.sample.size()/12;
}
break;
case DIV_CMD_SAMPLE_POS:
chan[c.chan].dacPos=c.value;
chan[c.chan].setPos=true;
break;
case DIV_CMD_PANNING: {
chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4);
chWrite(c.chan,0x05,isMuted[c.chan]?0:chan[c.chan].pan);