Skip to content

Commit

Permalink
Fix drum crash
Browse files Browse the repository at this point in the history
  • Loading branch information
louist103 committed Apr 17, 2024
1 parent aa71033 commit 870387e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
12 changes: 3 additions & 9 deletions ZAPD/ZAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ void ZAudio::ParseXML(tinyxml2::XMLElement* reader)
}
}

void ZAudio::DecodeADPCMSample(SampleEntry* sample)
{
int16_t buffer[1024 * 128];

int16_t* out = &buffer[0];
}

std::vector<AdsrEnvelope*> ZAudio::ParseEnvelopeData(std::vector<uint8_t> audioBank, std::vector<uint8_t> audioTable, int envelopeOffset, int baseOffset)
{
std::vector<AdsrEnvelope*> result;
Expand Down Expand Up @@ -252,9 +245,9 @@ void ZAudio::ParseSoundFont(std::vector<uint8_t> codeData, std::vector<uint8_t>
drum.loaded = codeData[samplePtr + 2];
drum.tuning = BitConverter::ToFloatBE(codeData, samplePtr + 8);
drum.env = ParseEnvelopeData(codeData, audioTable, BitConverter::ToInt32BE(codeData, samplePtr + 12) + ptr, ptr);
entry.drums.push_back(drum);
}

entry.drums.push_back(drum);

currentOffset += 4;
}
Expand Down Expand Up @@ -301,8 +294,9 @@ void ZAudio::ParseSoundFont(std::vector<uint8_t> codeData, std::vector<uint8_t>
instrument.highNotesSound = ParseSoundFontEntry(
codeData, audioTable, audioSampleBank[sampleBankId1], sampleBankId1, currentOffset + 24, ptr);
}

// Interesting audio bug if you put this next line in the if block
entry.instruments.push_back(instrument);

}
}

Expand Down
1 change: 0 additions & 1 deletion ZAPD/ZAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class ZAudio : public ZResource

void ParseXML(tinyxml2::XMLElement* reader) override;

void DecodeADPCMSample(SampleEntry* sample);
std::vector<AdsrEnvelope*> ParseEnvelopeData(std::vector<uint8_t> audioBank, std::vector<uint8_t> audioTable,
int envelopeOffset, int baseOffset);

Expand Down

0 comments on commit 870387e

Please sign in to comment.