unacceptable.
This commit is contained in:
tildearrow 2022-03-21 21:47:27 -05:00
parent 322981b021
commit cec5def347
3 changed files with 9 additions and 1 deletions

View file

@ -1030,6 +1030,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
reader.read(samplePtr,ds.sampleLen*4); reader.read(samplePtr,ds.sampleLen*4);
for (int i=0; i<numberOfPats; i++) patPtr.push_back(reader.readI()); for (int i=0; i<numberOfPats; i++) patPtr.push_back(reader.readI());
logD("reading orders (%d)...\n",ds.ordersLen);
for (int i=0; i<tchans; i++) { for (int i=0; i<tchans; i++) {
for (int j=0; j<ds.ordersLen; j++) { for (int j=0; j<ds.ordersLen; j++) {
ds.orders.ord[i][j]=reader.readC(); ds.orders.ord[i][j]=reader.readC();
@ -1069,6 +1070,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
// read instruments // read instruments
for (int i=0; i<ds.insLen; i++) { for (int i=0; i<ds.insLen; i++) {
DivInstrument* ins=new DivInstrument; DivInstrument* ins=new DivInstrument;
logD("reading instrument %d at %x...\n",i,insPtr[i]);
reader.seek(insPtr[i],SEEK_SET); reader.seek(insPtr[i],SEEK_SET);
if (ins->readInsData(reader,ds.version)!=DIV_DATA_SUCCESS) { if (ins->readInsData(reader,ds.version)!=DIV_DATA_SUCCESS) {
@ -1084,6 +1086,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
// read wavetables // read wavetables
for (int i=0; i<ds.waveLen; i++) { for (int i=0; i<ds.waveLen; i++) {
DivWavetable* wave=new DivWavetable; DivWavetable* wave=new DivWavetable;
logD("reading wavetable %d at %x...\n",i,wavePtr[i]);
reader.seek(wavePtr[i],SEEK_SET); reader.seek(wavePtr[i],SEEK_SET);
if (wave->readWaveData(reader,ds.version)!=DIV_DATA_SUCCESS) { if (wave->readWaveData(reader,ds.version)!=DIV_DATA_SUCCESS) {
@ -1111,6 +1114,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
} }
reader.readI(); reader.readI();
DivSample* sample=new DivSample; DivSample* sample=new DivSample;
logD("reading sample %d at %x...\n",i,samplePtr[i]);
sample->name=reader.readString(); sample->name=reader.readString();
sample->samples=reader.readI(); sample->samples=reader.readI();
@ -1184,6 +1188,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
for (int i: patPtr) { for (int i: patPtr) {
reader.seek(i,SEEK_SET); reader.seek(i,SEEK_SET);
reader.read(magic,4); reader.read(magic,4);
logD("reading pattern in %x...\n",i);
if (strcmp(magic,"PATR")!=0) { if (strcmp(magic,"PATR")!=0) {
logE("%x: invalid pattern header!\n",i); logE("%x: invalid pattern header!\n",i);
lastError="invalid pattern header!"; lastError="invalid pattern header!";
@ -1196,6 +1201,8 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
int index=reader.readS(); int index=reader.readS();
reader.readI(); reader.readI();
logD("- %d, %d\n",chan,index);
DivPattern* pat=ds.pat[chan].getPattern(index,true); DivPattern* pat=ds.pat[chan].getPattern(index,true);
for (int j=0; j<ds.patLen; j++) { for (int j=0; j<ds.patLen; j++) {
pat->data[j][0]=reader.readS(); pat->data[j][0]=reader.readS();

View file

@ -279,6 +279,7 @@ bool DivSample::trim(unsigned int begin, unsigned int end) {
#define RESAMPLE_END \ #define RESAMPLE_END \
samples=finalCount; \ samples=finalCount; \
if (loopStart>=0) loopStart=(double)loopStart*(r/(double)rate); \
if (depth==16) { \ if (depth==16) { \
delete[] oldData16; \ delete[] oldData16; \
} else if (depth==8) { \ } else if (depth==8) { \

View file

@ -2435,9 +2435,9 @@ bool FurnaceGUI::loop() {
if (outFile!=NULL) { if (outFile!=NULL) {
if (fwrite(w->getFinalBuf(),1,w->size(),outFile)!=w->size()) { if (fwrite(w->getFinalBuf(),1,w->size(),outFile)!=w->size()) {
logW("did not write backup entirely: %s!\n",strerror(errno)); logW("did not write backup entirely: %s!\n",strerror(errno));
fclose(outFile);
w->finish(); w->finish();
} }
fclose(outFile);
} else { } else {
logW("could not save backup: %s!\n",strerror(errno)); logW("could not save backup: %s!\n",strerror(errno));
w->finish(); w->finish();