fix .dmf loading..... again (I think)

This commit is contained in:
tildearrow 2023-04-10 01:09:58 -05:00
parent 8375256ff7
commit 9e615bb3aa

View file

@ -902,13 +902,14 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
} }
#endif #endif
int scaledLen=(double)length/samplePitches[pitch]; int scaledLen=ceil((double)length/samplePitches[pitch]);
if (scaledLen>0) { if (scaledLen>0) {
// resample // resample
logD("%d: scaling from %d...",i,pitch); logD("%d: scaling from %d...",i,pitch);
short* newData=new short[scaledLen]; short* newData=new short[scaledLen];
memset(newData,0,scaledLen*sizeof(short));
int k=0; int k=0;
float mult=(float)(vol)/50.0f; float mult=(float)(vol)/50.0f;
for (double j=0; j<length; j+=samplePitches[pitch]) { for (double j=0; j<length; j+=samplePitches[pitch]) {