pad ADPCM-A/B samples to 256 bytes upon conversion
issue #1910 also warn if the sample is an ADPCM-A or ADPCM-B one and it is not padded
This commit is contained in:
parent
5acb17200a
commit
3c043bd100
2 changed files with 11 additions and 4 deletions
|
|
@ -579,13 +579,13 @@ bool DivSample::initInternal(DivSampleDepth d, int count) {
|
|||
break;
|
||||
case DIV_SAMPLE_DEPTH_ADPCM_A: // ADPCM-A
|
||||
if (dataA!=NULL) delete[] dataA;
|
||||
lengthA=(count+1)/2;
|
||||
lengthA=(((count+1)/2)+255)&(~0xff);
|
||||
dataA=new unsigned char[(lengthA+255)&(~0xff)];
|
||||
memset(dataA,0x80,(lengthA+255)&(~0xff));
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_ADPCM_B: // ADPCM-B
|
||||
if (dataB!=NULL) delete[] dataB;
|
||||
lengthB=(count+1)/2;
|
||||
lengthB=(((count+1)/2)+255)&(~0xff);
|
||||
dataB=new unsigned char[(lengthB+255)&(~0xff)];
|
||||
memset(dataB,0x80,(lengthB+255)&(~0xff));
|
||||
break;
|
||||
|
|
@ -872,10 +872,10 @@ void DivSample::convert(DivSampleDepth newDepth, unsigned int formatMask) {
|
|||
setSampleCount((samples+1)&(~1));
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_ADPCM_A: // ADPCM-A
|
||||
setSampleCount((samples+1)&(~1));
|
||||
setSampleCount((samples+511)&(~511));
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_ADPCM_B: // ADPCM-B
|
||||
setSampleCount((samples+1)&(~1));
|
||||
setSampleCount((samples+511)&(~511));
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_ADPCM_K: // K05 ADPCM
|
||||
setSampleCount((samples+1)&(~1));
|
||||
|
|
|
|||
|
|
@ -593,6 +593,13 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
}
|
||||
|
||||
// ADPCM-A/B specific warnings
|
||||
if (sample->depth==DIV_SAMPLE_DEPTH_ADPCM_A || sample->depth==DIV_SAMPLE_DEPTH_ADPCM_B) {
|
||||
if (sample->samples&511) {
|
||||
SAMPLE_WARN(warnLength,_("ADPCM sample is not padded to 256 bytes!"));
|
||||
}
|
||||
}
|
||||
|
||||
// chips grid
|
||||
if (dispatch==NULL) continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue