fix 4 bit pcm

This commit is contained in:
Eknous-P 2025-06-04 14:37:01 +04:00
parent bcf4f5f508
commit 000c85b4cb
4 changed files with 38 additions and 11 deletions

View file

@ -505,6 +505,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
case DIV_SAMPLE_DEPTH_ADPCM_B:
case DIV_SAMPLE_DEPTH_ADPCM_K:
case DIV_SAMPLE_DEPTH_VOX:
case DIV_SAMPLE_DEPTH_4BIT:
samples=lenDivided*2;
break;
case DIV_SAMPLE_DEPTH_IMA_ADPCM:
@ -617,6 +618,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
case DIV_SAMPLE_DEPTH_ADPCM_B:
case DIV_SAMPLE_DEPTH_ADPCM_K:
case DIV_SAMPLE_DEPTH_VOX:
case DIV_SAMPLE_DEPTH_4BIT:
// swap nibbles
for (unsigned int i=0; i<sample->getCurBufLen(); i++) {
b[i]=(b[i]<<4)|(b[i]>>4);
@ -629,7 +631,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
for (unsigned int i=0; i<sample->getCurBufLen(); i++) {
b[i]=(((b[i]&7)<<4)|(((b[i]>>3)&15)^((b[i]&0x80)?15:0))|(b[i]&0x80))^0xff;
}
break;
break;\
default:
break;
}