From 60f873e76e5fecdb302073b5b0d1c34ef141cfaf Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 9 May 2016 19:52:19 -1000 Subject: [PATCH] Add MIDI-setup reading --- include/amuse/AudioGroupProject.hpp | 2 +- lib/AudioGroupProject.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/amuse/AudioGroupProject.hpp b/include/amuse/AudioGroupProject.hpp index 544f987..0cf85d0 100644 --- a/include/amuse/AudioGroupProject.hpp +++ b/include/amuse/AudioGroupProject.hpp @@ -35,7 +35,7 @@ struct SongGroupIndex : AudioGroupIndex uint8_t reverb; uint8_t chorus; }; - std::unordered_map> m_midiSetups; + std::unordered_map*> m_midiSetups; }; /** Root index of SFXGroup */ diff --git a/lib/AudioGroupProject.cpp b/lib/AudioGroupProject.cpp index bdfdbbc..55eb292 100644 --- a/lib/AudioGroupProject.cpp +++ b/lib/AudioGroupProject.cpp @@ -70,6 +70,17 @@ AudioGroupProject::AudioGroupProject(const unsigned char* data) idx.m_drumPages[drumEntries->programNo] = drumEntries; ++drumEntries; } + + /* MIDI setups */ + const uint8_t* setupData = data + header.midiSetupsOff; + const uint8_t* setupEnd = data + header.groupEndOff; + while (setupData < setupEnd) + { + uint32_t songId = SBig(*reinterpret_cast(setupData)); + idx.m_midiSetups[songId] = + reinterpret_cast*>(setupData + 4); + setupData += 5 * 16 + 4; + } } else if (header.type == GroupType::SFX) {