SoundUnit: fix PCM pitch
This commit is contained in:
parent
a6ef36d42e
commit
ce40085d3b
|
@ -120,7 +120,12 @@ void DivPlatformSoundUnit::tick(bool sysTick) {
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
chan[i].std.next();
|
chan[i].std.next();
|
||||||
if (chan[i].std.vol.had) {
|
if (chan[i].std.vol.had) {
|
||||||
|
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SU);
|
||||||
|
if (ins->type==DIV_INS_AMIGA) {
|
||||||
|
chan[i].outVol=((chan[i].vol&127)*MIN(64,chan[i].std.vol.val))>>6;
|
||||||
|
} else {
|
||||||
chan[i].outVol=((chan[i].vol&127)*MIN(127,chan[i].std.vol.val))>>7;
|
chan[i].outVol=((chan[i].vol&127)*MIN(127,chan[i].std.vol.val))>>7;
|
||||||
|
}
|
||||||
chWrite(i,0x02,chan[i].outVol);
|
chWrite(i,0x02,chan[i].outVol);
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
|
@ -183,11 +188,11 @@ void DivPlatformSoundUnit::tick(bool sysTick) {
|
||||||
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SU);
|
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SU);
|
||||||
DivSample* sample=parent->getSample(ins->amiga.initSample);
|
DivSample* sample=parent->getSample(ins->amiga.initSample);
|
||||||
if (sample!=NULL) {
|
if (sample!=NULL) {
|
||||||
double off=1.0;
|
double off=0.25;
|
||||||
if (sample->centerRate<1) {
|
if (sample->centerRate<1) {
|
||||||
off=1.0;
|
off=0.25;
|
||||||
} else {
|
} else {
|
||||||
off=(double)sample->centerRate/8363.0;
|
off=(double)sample->centerRate/(8363.0*4.0);
|
||||||
}
|
}
|
||||||
chan[i].freq=(double)chan[i].freq*off;
|
chan[i].freq=(double)chan[i].freq*off;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue