diff --git a/src/engine/fileOps/pps.cpp b/src/engine/fileOps/pps.cpp index 6c0ded2de..3ee81862a 100644 --- a/src/engine/fileOps/pps.cpp +++ b/src/engine/fileOps/pps.cpp @@ -93,7 +93,7 @@ void DivEngine::loadPPS(SafeReader& reader, std::vector& ret, String s->rate = PPS_SAMPLE_RATE; s->centerRate = PPS_SAMPLE_RATE; s->depth = DIV_SAMPLE_DEPTH_4BIT; - s->init(headers[i].sample_length*2); //byte per sample + s->init(headers[i].sample_length); reader.seek((int)headers[i].start_pointer, SEEK_SET); diff --git a/src/engine/sample.cpp b/src/engine/sample.cpp index 6a52ede6a..19e33032e 100644 --- a/src/engine/sample.cpp +++ b/src/engine/sample.cpp @@ -877,6 +877,7 @@ void DivSample::convert(DivSampleDepth newDepth, unsigned int formatMask) { break; case DIV_SAMPLE_DEPTH_4BIT: setSampleCount((samples+1)&(~1)); + break; default: break; } @@ -1338,9 +1339,9 @@ void DivSample::render(unsigned int formatMask) { unsigned short nibble=0; for (unsigned int i=0; i>1]&0xf; } else { - nibble=data4[i/2]>>4; + nibble=data4[i>>1]>>4; } data16[i]=(nibble<<12)^0x8000; } @@ -1558,7 +1559,7 @@ void DivSample::render(unsigned int formatMask) { _sample=(*samplePtr++^0x8000)>>12; sample4|=_sample; } - data4[i/2]=sample4; + data4[i>>1]=sample4; } } }