fix sample issues - part 5 (final?)

This commit is contained in:
tildearrow 2024-02-02 13:55:42 -05:00
parent 94cce86180
commit 35bca6e90c
12 changed files with 82 additions and 7 deletions

View file

@ -236,6 +236,8 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
chan[c.chan].pcm=true;
} else if (chan[c.chan].furnaceDac) {
chan[c.chan].pcm=false;
chan[c.chan].sampleNote=DIV_NOTE_NULL;
chan[c.chan].sampleNoteDelta=0;
}
if (chan[c.chan].pcm) {
if (skipRegisterWrites) break;
@ -245,6 +247,9 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
chan[c.chan].sampleNote=c.value;
c.value=ins->amiga.getFreq(c.value);
chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote;
} else if (chan[c.chan].sampleNote!=DIV_NOTE_NULL) {
chan[c.chan].dacSample=ins->amiga.getSample(chan[c.chan].sampleNote);
c.value=ins->amiga.getFreq(chan[c.chan].sampleNote);
}
if (chan[c.chan].dacSample<0 || chan[c.chan].dacSample>=parent->song.sampleLen) {
chan[c.chan].dacSample=-1;
@ -272,6 +277,8 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
//chan[c.chan].keyOn=true;
chan[c.chan].furnaceDac=true;
} else {
chan[c.chan].sampleNote=DIV_NOTE_NULL;
chan[c.chan].sampleNoteDelta=0;
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].note=c.value;
}
@ -316,6 +323,8 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
chan[c.chan].dacSample=-1;
if (dumpWrites) addWrite(0xffff0002+(c.chan<<8),0);
chan[c.chan].pcm=false;
chan[c.chan].sampleNote=DIV_NOTE_NULL;
chan[c.chan].sampleNoteDelta=0;
chan[c.chan].active=false;
chan[c.chan].keyOff=true;
chan[c.chan].macroInit(NULL);
@ -384,6 +393,10 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
case DIV_CMD_SAMPLE_MODE:
if (c.chan!=2) { // pulse
chan[c.chan].pcm=c.value;
if (!chan[c.chan].pcm) {
chan[c.chan].sampleNote=DIV_NOTE_NULL;
chan[c.chan].sampleNoteDelta=0;
}
}
break;
case DIV_CMD_SAMPLE_BANK: