From 870387e9d2ded57913b9dbc87214c05f1e1e7a04 Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Tue, 16 Apr 2024 20:57:15 -0400 Subject: [PATCH] Fix drum crash --- ZAPD/ZAudio.cpp | 12 +++--------- ZAPD/ZAudio.h | 1 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ZAPD/ZAudio.cpp b/ZAPD/ZAudio.cpp index 9f20592..8c72cdd 100644 --- a/ZAPD/ZAudio.cpp +++ b/ZAPD/ZAudio.cpp @@ -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 ZAudio::ParseEnvelopeData(std::vector audioBank, std::vector audioTable, int envelopeOffset, int baseOffset) { std::vector result; @@ -252,9 +245,9 @@ void ZAudio::ParseSoundFont(std::vector codeData, std::vector 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; } @@ -301,8 +294,9 @@ void ZAudio::ParseSoundFont(std::vector codeData, std::vector 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); + } } diff --git a/ZAPD/ZAudio.h b/ZAPD/ZAudio.h index 286c75c..ddd4078 100644 --- a/ZAPD/ZAudio.h +++ b/ZAPD/ZAudio.h @@ -107,7 +107,6 @@ class ZAudio : public ZResource void ParseXML(tinyxml2::XMLElement* reader) override; - void DecodeADPCMSample(SampleEntry* sample); std::vector ParseEnvelopeData(std::vector audioBank, std::vector audioTable, int envelopeOffset, int baseOffset);