mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-16 01:35:07 +00:00
YMU759: ADPCM
This commit is contained in:
parent
7218710268
commit
315018ff24
1 changed files with 10 additions and 5 deletions
|
@ -568,6 +568,7 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[adpcmChan].freqChanged) {
|
if (chan[adpcmChan].freqChanged) {
|
||||||
|
printf("freq changed\n");
|
||||||
if (chan[adpcmChan].sample>=0 && chan[adpcmChan].sample<parent->song.sampleLen) {
|
if (chan[adpcmChan].sample>=0 && chan[adpcmChan].sample<parent->song.sampleLen) {
|
||||||
double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/8363.0;
|
double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/8363.0;
|
||||||
chan[adpcmChan].freq=parent->calcFreq(chan[adpcmChan].baseFreq,chan[adpcmChan].pitch,false,4,chan[adpcmChan].pitch2,(double)chipClock/144,off);
|
chan[adpcmChan].freq=parent->calcFreq(chan[adpcmChan].baseFreq,chan[adpcmChan].pitch,false,4,chan[adpcmChan].pitch2,(double)chipClock/144,off);
|
||||||
|
@ -733,7 +734,7 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
int end=s->offB+s->lengthB-1;
|
int end=s->offB+s->lengthB-1;
|
||||||
immWrite(11,(end>>2)&0xff);
|
immWrite(11,(end>>2)&0xff);
|
||||||
immWrite(12,(end>>10)&0xff);
|
immWrite(12,(end>>10)&0xff);
|
||||||
immWrite(8,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|2);
|
immWrite(8,2);
|
||||||
immWrite(7,(s->loopStart>=0)?0xb0:0xa0); // start/repeat
|
immWrite(7,(s->loopStart>=0)?0xb0:0xa0); // start/repeat
|
||||||
if (c.value!=DIV_NOTE_NULL) {
|
if (c.value!=DIV_NOTE_NULL) {
|
||||||
chan[c.chan].note=c.value;
|
chan[c.chan].note=c.value;
|
||||||
|
@ -768,10 +769,11 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
int end=s->offB+s->lengthB-1;
|
int end=s->offB+s->lengthB-1;
|
||||||
immWrite(11,(end>>2)&0xff);
|
immWrite(11,(end>>2)&0xff);
|
||||||
immWrite(12,(end>>10)&0xff);
|
immWrite(12,(end>>10)&0xff);
|
||||||
immWrite(8,isMuted[c.chan]?0:(chan[c.chan].pan<<6));
|
immWrite(8,2);
|
||||||
immWrite(7,(s->loopStart>=0)?0x90:0x80); // start/repeat
|
immWrite(7,(s->loopStart>=0)?0xb0:0xa0); // start/repeat
|
||||||
chan[c.chan].baseFreq=(((unsigned int)s->rate)<<16)/(chipClock/144);
|
int freq=(65536.0*(double)s->rate)/(double)rate;
|
||||||
chan[c.chan].freqChanged=true;
|
immWrite(16,freq&0xff);
|
||||||
|
immWrite(17,(freq>>8)&0xff);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -947,6 +949,9 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_PITCH: {
|
case DIV_CMD_PITCH: {
|
||||||
|
if (c.chan==adpcmChan) {
|
||||||
|
if (!chan[c.chan].furnacePCM) break;
|
||||||
|
}
|
||||||
chan[c.chan].pitch=c.value;
|
chan[c.chan].pitch=c.value;
|
||||||
chan[c.chan].freqChanged=true;
|
chan[c.chan].freqChanged=true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue