diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 460f7d8d8..b50eb74ae 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -1030,6 +1030,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { reader.read(samplePtr,ds.sampleLen*4); for (int i=0; ireadInsData(reader,ds.version)!=DIV_DATA_SUCCESS) { @@ -1084,6 +1086,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { // read wavetables for (int i=0; ireadWaveData(reader,ds.version)!=DIV_DATA_SUCCESS) { @@ -1111,6 +1114,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { } reader.readI(); DivSample* sample=new DivSample; + logD("reading sample %d at %x...\n",i,samplePtr[i]); sample->name=reader.readString(); sample->samples=reader.readI(); @@ -1184,6 +1188,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { for (int i: patPtr) { reader.seek(i,SEEK_SET); reader.read(magic,4); + logD("reading pattern in %x...\n",i); if (strcmp(magic,"PATR")!=0) { logE("%x: invalid pattern header!\n",i); lastError="invalid pattern header!"; @@ -1196,6 +1201,8 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { int index=reader.readS(); reader.readI(); + logD("- %d, %d\n",chan,index); + DivPattern* pat=ds.pat[chan].getPattern(index,true); for (int j=0; jdata[j][0]=reader.readS(); diff --git a/src/engine/sample.cpp b/src/engine/sample.cpp index be9c5029c..69e61e547 100644 --- a/src/engine/sample.cpp +++ b/src/engine/sample.cpp @@ -279,6 +279,7 @@ bool DivSample::trim(unsigned int begin, unsigned int end) { #define RESAMPLE_END \ samples=finalCount; \ + if (loopStart>=0) loopStart=(double)loopStart*(r/(double)rate); \ if (depth==16) { \ delete[] oldData16; \ } else if (depth==8) { \ diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2ba2131cc..7a1464254 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -2435,9 +2435,9 @@ bool FurnaceGUI::loop() { if (outFile!=NULL) { if (fwrite(w->getFinalBuf(),1,w->size(),outFile)!=w->size()) { logW("did not write backup entirely: %s!\n",strerror(errno)); - fclose(outFile); w->finish(); } + fclose(outFile); } else { logW("could not save backup: %s!\n",strerror(errno)); w->finish();