mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-01 18:42:40 +00:00
Dave: implement sample offset
This commit is contained in:
parent
a88b63cf31
commit
41e59cee5f
2 changed files with 18 additions and 5 deletions
|
@ -70,7 +70,7 @@ void DivPlatformDave::acquire(short** buf, size_t len) {
|
|||
chan[i].dacPeriod+=chan[i].dacRate;
|
||||
while (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;
|
||||
writeControl=true;
|
||||
chan[0].writeVol=true;
|
||||
|
@ -196,7 +196,11 @@ void DivPlatformDave::tick(bool sysTick) {
|
|||
if (chan[i].std.phaseReset.had && chan[i].std.phaseReset.val==1) {
|
||||
if (i>=4) {
|
||||
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;
|
||||
chan[i].keyOn=true;
|
||||
}
|
||||
|
@ -324,7 +328,11 @@ int DivPlatformDave::dispatch(DivCommand c) {
|
|||
chan[c.chan].freqChanged=true;
|
||||
chan[c.chan].note=c.value;
|
||||
}
|
||||
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;
|
||||
writeControl=true;
|
||||
} else {
|
||||
|
@ -459,6 +467,10 @@ int DivPlatformDave::dispatch(DivCommand c) {
|
|||
if (!chan[c.chan].inPorta && c.value && !parent->song.brokenPortaArp && chan[c.chan].std.arp.will && !NEW_ARP_STRAT) chan[c.chan].baseFreq=NOTE_PERIODIC(chan[c.chan].note);
|
||||
chan[c.chan].inPorta=c.value;
|
||||
break;
|
||||
case DIV_CMD_SAMPLE_POS:
|
||||
chan[c.chan].dacPos=c.value;
|
||||
chan[c.chan].setPos=true;
|
||||
break;
|
||||
case DIV_CMD_GET_VOLMAX:
|
||||
return 63;
|
||||
break;
|
||||
|
|
|
@ -33,7 +33,7 @@ class DivPlatformDave: public DivDispatch {
|
|||
unsigned char panL;
|
||||
unsigned char panR;
|
||||
unsigned char wave;
|
||||
bool writeVol, highPass, ringMod, swapCounters, lowPass, resetPhase;
|
||||
bool writeVol, highPass, ringMod, swapCounters, lowPass, resetPhase, setPos;
|
||||
Channel():
|
||||
SharedChannel<signed char>(63),
|
||||
dacPeriod(0),
|
||||
|
@ -50,7 +50,8 @@ class DivPlatformDave: public DivDispatch {
|
|||
ringMod(false),
|
||||
swapCounters(false),
|
||||
lowPass(false),
|
||||
resetPhase(false) {}
|
||||
resetPhase(false),
|
||||
setPos(false) {}
|
||||
};
|
||||
Channel chan[6];
|
||||
DivDispatchOscBuffer* oscBuf[6];
|
||||
|
|
Loading…
Reference in a new issue