mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 15:03:01 +00:00
C219: finish C219 sample format
This commit is contained in:
parent
da7ad75afd
commit
e6c52e34d1
2 changed files with 14 additions and 10 deletions
|
@ -209,7 +209,7 @@ void DivPlatformC140::tick(bool sysTick) {
|
|||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||
if (is219) {
|
||||
ctrl|=(chan[i].active?0x80:0)|((s->isLoopable())?0x10:0)|((s->depth==DIV_SAMPLE_DEPTH_MULAW)?1:0)|(chan[i].invert?0x40:0)|(chan[i].surround?8:0)|(chan[i].noise?4:0);
|
||||
ctrl|=(chan[i].active?0x80:0)|((s->isLoopable())?0x10:0)|((s->depth==DIV_SAMPLE_DEPTH_C219)?1:0)|(chan[i].invert?0x40:0)|(chan[i].surround?8:0)|(chan[i].noise?4:0);
|
||||
} else {
|
||||
ctrl|=(chan[i].active?0x80:0)|((s->isLoopable())?0x10:0)|((s->depth==DIV_SAMPLE_DEPTH_MULAW)?0x08:0);
|
||||
}
|
||||
|
|
|
@ -1328,16 +1328,20 @@ void DivSample::render(unsigned int formatMask) {
|
|||
for (unsigned int i=0; i<samples; i++) {
|
||||
short s=data16[i];
|
||||
unsigned char x=0;
|
||||
if (s>0) {
|
||||
if (s>17152) { // 100+
|
||||
x=((s-17152)>>9)+100;
|
||||
} else {
|
||||
int b=bsr(s)&15;
|
||||
x=(s>>c219ShiftToVal[b])+c219HighBitPos[b];
|
||||
}
|
||||
} else if (s<0) {
|
||||
bool negate=s&0x8000;
|
||||
if (negate) {
|
||||
s^=0xffff;
|
||||
}
|
||||
dataC219[i]=x;
|
||||
if (s==0) {
|
||||
x=0;
|
||||
} else if (s>17152) { // 100+
|
||||
x=((s-17152)>>9)+100;
|
||||
} else {
|
||||
int b=bsr(s)-1;
|
||||
x=((s-(c219Table[c219HighBitPos[b]]))>>c219ShiftToVal[b])+c219HighBitPos[b];
|
||||
}
|
||||
if (x>127) x=127;
|
||||
dataC219[i]=x|(negate?0x80:0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue