From d10a0ac7f1ea64099ab6ca6d49a1cdc3fe4b45f6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 8 Sep 2019 16:52:55 -0400 Subject: [PATCH 1/2] General: Be explicit about athena's SeekOrigin type Allows the code to still compile if the enum is turned into an enum class. --- include/amuse/AudioGroupPool.hpp | 8 +- include/amuse/AudioGroupProject.hpp | 8 +- include/amuse/AudioGroupSampleDirectory.hpp | 10 +- lib/AudioGroupPool.cpp | 36 +-- lib/AudioGroupProject.cpp | 233 +++++++++++--------- lib/AudioGroupSampleDirectory.cpp | 22 +- 6 files changed, 170 insertions(+), 147 deletions(-) diff --git a/include/amuse/AudioGroupPool.hpp b/include/amuse/AudioGroupPool.hpp index aae27a9..20bd954 100644 --- a/include/amuse/AudioGroupPool.hpp +++ b/include/amuse/AudioGroupPool.hpp @@ -36,7 +36,7 @@ struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) ObjectHe AT_DECL_DNA Value size; ObjectIdDNA objectId; - Seek<2, athena::Current> pad; + Seek<2, athena::SeekOrigin::Current> pad; }; struct SoundMacro { @@ -908,7 +908,7 @@ struct SoundMacro { static const CmdIntrospection Introspective; Value varCtrlA; Value a; - Seek<1, athena::Current> pad; + Seek<1, athena::SeekOrigin::Current> pad; Value imm; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::SetVar; } @@ -1100,7 +1100,7 @@ struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) KeymapDN Value transpose; Value pan; /* -128 for surround-channel only */ Value prioOffset; - Seek<3, athena::Current> pad; + Seek<3, athena::SeekOrigin::Current> pad; }; struct Keymap : BigDNA { AT_DECL_DNA_YAML @@ -1142,7 +1142,7 @@ struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) LayerMap Value prioOffset; Value span; Value pan; - Seek<3, athena::Current> pad; + Seek<3, athena::SeekOrigin::Current> pad; }; struct LayerMapping : BigDNA { AT_DECL_DNA_YAML diff --git a/include/amuse/AudioGroupProject.hpp b/include/amuse/AudioGroupProject.hpp index 4594c26..b3c92e1 100644 --- a/include/amuse/AudioGroupProject.hpp +++ b/include/amuse/AudioGroupProject.hpp @@ -46,7 +46,7 @@ struct SongGroupIndex : AudioGroupIndex { Value priority; Value maxVoices; Value programNo; - Seek<1, athena::Current> pad; + Seek<1, athena::SeekOrigin::Current> pad; }; template struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) MusyX1PageEntryDNA : BigDNA { @@ -56,7 +56,7 @@ struct SongGroupIndex : AudioGroupIndex { Value maxVoices; Value unk; Value programNo; - Seek<2, athena::Current> pad; + Seek<2, athena::SeekOrigin::Current> pad; }; struct PageEntry : BigDNA { AT_DECL_DNA_YAML @@ -94,7 +94,7 @@ struct SongGroupIndex : AudioGroupIndex { Value panning; Value reverb; Value chorus; - Seek<3, athena::Current> pad; + Seek<3, athena::SeekOrigin::Current> pad; }; struct MIDISetup : BigDNA { AT_DECL_DNA_YAML @@ -130,7 +130,7 @@ struct SFXGroupIndex : AudioGroupIndex { Value defVel; Value panning; Value defKey; - Seek<1, athena::Current> pad; + Seek<1, athena::SeekOrigin::Current> pad; }; struct SFXEntry : BigDNA { AT_DECL_DNA_YAML diff --git a/include/amuse/AudioGroupSampleDirectory.hpp b/include/amuse/AudioGroupSampleDirectory.hpp index a849e55..7900e2d 100644 --- a/include/amuse/AudioGroupSampleDirectory.hpp +++ b/include/amuse/AudioGroupSampleDirectory.hpp @@ -31,7 +31,7 @@ struct DSPADPCMHeader : BigDNA { Value x46_loop_hist1 = 0; Value x48_loop_hist2 = 0; Value m_pitch = 0; // Stash this in the padding - Seek<21, athena::Current> pad; + Seek<21, athena::SeekOrigin::Current> pad; }; struct VADPCMHeader : BigDNA { @@ -156,11 +156,11 @@ public: struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) EntryDNA : BigDNA { AT_DECL_DNA SampleIdDNA m_sfxId; - Seek<2, athena::Current> pad; + Seek<2, athena::SeekOrigin::Current> pad; Value m_sampleOff; Value m_unk; Value m_pitch; - Seek<1, athena::Current> pad2; + Seek<1, athena::SeekOrigin::Current> pad2; Value m_sampleRate; Value m_numSamples; // Top 8 bits is SampleFormat Value m_loopStartSample; @@ -177,7 +177,7 @@ public: struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) MusyX1SdirEntry : BigDNA { AT_DECL_DNA SampleIdDNA m_sfxId; - Seek<2, athena::Current> pad; + Seek<2, athena::SeekOrigin::Current> pad; Value m_sampleOff; Value m_pitchSampleRate; Value m_numSamples; @@ -188,7 +188,7 @@ public: struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) MusyX1AbsSdirEntry : BigDNA { AT_DECL_DNA SampleIdDNA m_sfxId; - Seek<2, athena::Current> pad; + Seek<2, athena::SeekOrigin::Current> pad; Value m_sampleOff; Value m_unk; Value m_pitchSampleRate; diff --git a/lib/AudioGroupPool.cpp b/lib/AudioGroupPool.cpp index 7e5f4dc..574a523 100644 --- a/lib/AudioGroupPool.cpp +++ b/lib/AudioGroupPool.cpp @@ -88,7 +88,7 @@ struct IntrospectCmdOp { static bool AtEnd(athena::io::IStreamReader& r) { uint32_t v = r.readUint32Big(); - r.seek(-4, athena::Current); + r.seek(-4, athena::SeekOrigin::Current); return v == 0xffffffff; } @@ -100,7 +100,7 @@ AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r) { head.read(r); if (head.soundMacrosOffset) { - r.seek(head.soundMacrosOffset, athena::Begin); + r.seek(head.soundMacrosOffset, athena::SeekOrigin::Begin); while (!AtEnd(r)) { ObjectHeader objHead; atInt64 startPos = r.position(); @@ -111,12 +111,12 @@ AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r) { auto& macro = ret.m_soundMacros[objHead.objectId.id]; macro = MakeObj(); macro->template readCmds(r, objHead.size - 8); - r.seek(startPos + objHead.size, athena::Begin); + r.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } } if (head.tablesOffset) { - r.seek(head.tablesOffset, athena::Begin); + r.seek(head.tablesOffset, athena::SeekOrigin::Begin); while (!AtEnd(r)) { ObjectHeader objHead; atInt64 startPos = r.position(); @@ -139,12 +139,12 @@ AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r) { r.readUBytesToBuf(&static_cast(**ptr).data[0], objHead.size - 8); break; } - r.seek(startPos + objHead.size, athena::Begin); + r.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } } if (head.keymapsOffset) { - r.seek(head.keymapsOffset, athena::Begin); + r.seek(head.keymapsOffset, athena::SeekOrigin::Begin); while (!AtEnd(r)) { ObjectHeader objHead; atInt64 startPos = r.position(); @@ -159,12 +159,12 @@ AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r) { kmData.read(r); (*km)[i] = kmData; } - r.seek(startPos + objHead.size, athena::Begin); + r.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } } if (head.layersOffset) { - r.seek(head.layersOffset, athena::Begin); + r.seek(head.layersOffset, athena::SeekOrigin::Begin); while (!AtEnd(r)) { ObjectHeader objHead; atInt64 startPos = r.position(); @@ -182,7 +182,7 @@ AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r) { lmData.read(r); lm->push_back(lmData); } - r.seek(startPos + objHead.size, athena::Begin); + r.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } } @@ -1019,9 +1019,9 @@ std::vector AudioGroupPool::toData() const { p.second->template writeCmds(fo); objHead.size = fo.position() - startPos; objHead.objectId = p.first; - fo.seek(startPos, athena::Begin); + fo.seek(startPos, athena::SeekOrigin::Begin); objHead.write(fo); - fo.seek(startPos + objHead.size, athena::Begin); + fo.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } athena::io::Write::Do({}, term, fo); } @@ -1049,9 +1049,9 @@ std::vector AudioGroupPool::toData() const { } objHead.size = fo.position() - startPos; objHead.objectId = p.first; - fo.seek(startPos, athena::Begin); + fo.seek(startPos, athena::SeekOrigin::Begin); objHead.write(fo); - fo.seek(startPos + objHead.size, athena::Begin); + fo.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } athena::io::Write::Do({}, term, fo); } @@ -1068,9 +1068,9 @@ std::vector AudioGroupPool::toData() const { } objHead.size = fo.position() - startPos; objHead.objectId = p.first; - fo.seek(startPos, athena::Begin); + fo.seek(startPos, athena::SeekOrigin::Begin); objHead.write(fo); - fo.seek(startPos + objHead.size, athena::Begin); + fo.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } athena::io::Write::Do({}, term, fo); } @@ -1089,14 +1089,14 @@ std::vector AudioGroupPool::toData() const { } objHead.size = fo.position() - startPos; objHead.objectId = p.first; - fo.seek(startPos, athena::Begin); + fo.seek(startPos, athena::SeekOrigin::Begin); objHead.write(fo); - fo.seek(startPos + objHead.size, athena::Begin); + fo.seek(startPos + objHead.size, athena::SeekOrigin::Begin); } athena::io::Write::Do({}, term, fo); } - fo.seek(0, athena::Begin); + fo.seek(0, athena::SeekOrigin::Begin); head.write(fo); return fo.data(); diff --git a/lib/AudioGroupProject.cpp b/lib/AudioGroupProject.cpp index e7a28a2..21fd65f 100644 --- a/lib/AudioGroupProject.cpp +++ b/lib/AudioGroupProject.cpp @@ -13,19 +13,19 @@ namespace amuse { static bool AtEnd64(athena::io::IStreamReader& r) { uint64_t v = r.readUint64Big(); - r.seek(-8, athena::Current); + r.seek(-8, athena::SeekOrigin::Current); return v == 0xffffffffffffffff; } static bool AtEnd32(athena::io::IStreamReader& r) { uint32_t v = r.readUint32Big(); - r.seek(-4, athena::Current); + r.seek(-4, athena::SeekOrigin::Current); return v == 0xffffffff; } static bool AtEnd16(athena::io::IStreamReader& r) { uint16_t v = r.readUint16Big(); - r.seek(-2, athena::Current); + r.seek(-2, athena::SeekOrigin::Current); return v == 0xffff; } @@ -89,30 +89,35 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { GroupId::CurNameDB->registerPair(NameDB::generateName(header.groupId, NameDB::Type::Group), header.groupId); #if 0 - /* Sound Macros */ - r.seek(header.soundMacroIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); + /* Sound Macros */ + r.seek(header.soundMacroIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); + } - /* Samples */ - r.seek(header.samplIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + /* Samples */ + r.seek(header.samplIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + } - /* Tables */ - r.seek(header.tableIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + /* Tables */ + r.seek(header.tableIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + } - /* Keymaps */ - r.seek(header.keymapIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + /* Keymaps */ + r.seek(header.keymapIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + } - /* Layers */ - r.seek(header.layerIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + /* Layers */ + r.seek(header.layerIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + } #endif if (header.type == GroupType::Song) { @@ -120,7 +125,7 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { idx = MakeObj(); /* Normal pages */ - r.seek(header.pageTableOff, athena::Begin); + r.seek(header.pageTableOff, athena::SeekOrigin::Begin); while (!AtEnd64(r)) { SongGroupIndex::PageEntryDNA entry; entry.read(r); @@ -128,7 +133,7 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { } /* Drum pages */ - r.seek(header.drumTableOff, athena::Begin); + r.seek(header.drumTableOff, athena::SeekOrigin::Begin); while (!AtEnd64(r)) { SongGroupIndex::PageEntryDNA entry; entry.read(r); @@ -136,24 +141,26 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { } /* MIDI setups */ - r.seek(header.midiSetupsOff, athena::Begin); + r.seek(header.midiSetupsOff, athena::SeekOrigin::Begin); while (r.position() < header.groupEndOff) { uint16_t songId = r.readUint16Big(); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); std::array& setup = idx->m_midiSetups[songId]; - for (int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) { setup[i].read(r); - if (SongId::CurNameDB) + } + if (SongId::CurNameDB) { SongId::CurNameDB->registerPair(NameDB::generateName(songId, NameDB::Type::Song), songId); + } } } else if (header.type == GroupType::SFX) { auto& idx = m_sfxGroups[header.groupId]; idx = MakeObj(); /* SFX entries */ - r.seek(header.pageTableOff, athena::Begin); + r.seek(header.pageTableOff, athena::SeekOrigin::Begin); uint16_t count = r.readUint16Big(); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); idx->m_sfxEntries.reserve(count); for (int i = 0; i < count; ++i) { SFXGroupIndex::SFXEntryDNA entry; @@ -164,7 +171,7 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { } } - r.seek(header.groupEndOff, athena::Begin); + r.seek(header.groupEndOff, athena::SeekOrigin::Begin); } } @@ -181,30 +188,35 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade GroupId::CurNameDB->registerPair(NameDB::generateName(header.groupId, NameDB::Type::Group), header.groupId); #if 0 - /* Sound Macros */ - r.seek(subDataOff + header.soundMacroIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); + /* Sound Macros */ + r.seek(subDataOff + header.soundMacroIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); + } - /* Samples */ - r.seek(subDataOff + header.samplIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + /* Samples */ + r.seek(subDataOff + header.samplIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + } - /* Tables */ - r.seek(subDataOff + header.tableIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + /* Tables */ + r.seek(subDataOff + header.tableIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + } - /* Keymaps */ - r.seek(subDataOff + header.keymapIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + /* Keymaps */ + r.seek(subDataOff + header.keymapIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + } - /* Layers */ - r.seek(subDataOff + header.layerIdsOff, athena::Begin); - while (!AtEnd16(r)) - ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + /* Layers */ + r.seek(subDataOff + header.layerIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { + ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + } #endif if (header.type == GroupType::Song) { @@ -213,7 +225,7 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade if (absOffs) { /* Normal pages */ - r.seek(header.pageTableOff, athena::Begin); + r.seek(header.pageTableOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { SongGroupIndex::PageEntryDNA entry; entry.read(r); @@ -221,7 +233,7 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade } /* Drum pages */ - r.seek(header.drumTableOff, athena::Begin); + r.seek(header.drumTableOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { SongGroupIndex::PageEntryDNA entry; entry.read(r); @@ -229,19 +241,20 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade } /* MIDI setups */ - r.seek(header.midiSetupsOff, athena::Begin); + r.seek(header.midiSetupsOff, athena::SeekOrigin::Begin); while (r.position() < header.groupEndOff) { uint16_t songId; athena::io::Read::Do({}, songId, r); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); std::array& setup = idx->m_midiSetups[songId]; - for (int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) { setup[i].read(r); + } SongId::CurNameDB->registerPair(NameDB::generateName(songId, NameDB::Type::Song), songId); } } else { /* Normal pages */ - r.seek(subDataOff + header.pageTableOff, athena::Begin); + r.seek(subDataOff + header.pageTableOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { SongGroupIndex::MusyX1PageEntryDNA entry; entry.read(r); @@ -249,7 +262,7 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade } /* Drum pages */ - r.seek(subDataOff + header.drumTableOff, athena::Begin); + r.seek(subDataOff + header.drumTableOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { SongGroupIndex::MusyX1PageEntryDNA entry; entry.read(r); @@ -257,11 +270,11 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade } /* MIDI setups */ - r.seek(subDataOff + header.midiSetupsOff, athena::Begin); + r.seek(subDataOff + header.midiSetupsOff, athena::SeekOrigin::Begin); while (atInt64(r.position() + 4) < groupBegin + header.groupEndOff) { uint16_t songId; athena::io::Read::Do({}, songId, r); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); std::array& setup = idx->m_midiSetups[songId]; for (int i = 0; i < 16; ++i) { SongGroupIndex::MusyX1MIDISetup ent; @@ -276,24 +289,24 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade idx = MakeObj(); /* SFX entries */ - r.seek(subDataOff + header.pageTableOff, athena::Begin); + r.seek(subDataOff + header.pageTableOff, athena::SeekOrigin::Begin); uint16_t count; athena::io::Read::Do({}, count, r); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); idx->m_sfxEntries.reserve(count); for (int i = 0; i < count; ++i) { SFXGroupIndex::SFXEntryDNA entry; entry.read(r); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); idx->m_sfxEntries[entry.sfxId.id] = entry; SFXId::CurNameDB->registerPair(NameDB::generateName(entry.sfxId.id, NameDB::Type::SFX), entry.sfxId.id); } } if (absOffs) - r.seek(header.groupEndOff, athena::Begin); + r.seek(header.groupEndOff, athena::SeekOrigin::Begin); else - r.seek(groupBegin + header.groupEndOff, athena::Begin); + r.seek(groupBegin + header.groupEndOff, athena::SeekOrigin::Begin); } return ret; @@ -452,43 +465,47 @@ void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, GCNData GroupId::CurNameDB->registerPair(NameDB::generateName(header.groupId, NameDB::Type::Group), header.groupId); /* Sound Macros */ - r.seek(header.soundMacroIdsOff, athena::Begin); + r.seek(header.soundMacroIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); /* Samples */ - r.seek(header.samplIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(header.samplIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + } /* Tables */ - r.seek(header.tableIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(header.tableIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + } /* Keymaps */ - r.seek(header.keymapIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(header.keymapIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + } /* Layers */ - r.seek(header.layerIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(header.layerIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + } if (header.type == GroupType::Song) { /* MIDI setups */ - r.seek(header.midiSetupsOff, athena::Begin); + r.seek(header.midiSetupsOff, athena::SeekOrigin::Begin); while (r.position() < header.groupEndOff) { uint16_t id = r.readUint16Big(); SongId::CurNameDB->registerPair(NameDB::generateName(id, NameDB::Type::Song), id); - r.seek(2 + 5 * 16, athena::Current); + r.seek(2 + 5 * 16, athena::SeekOrigin::Current); } } else if (header.type == GroupType::SFX) { /* SFX entries */ - r.seek(header.pageTableOff, athena::Begin); + r.seek(header.pageTableOff, athena::SeekOrigin::Begin); uint16_t count = r.readUint16Big(); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); for (int i = 0; i < count; ++i) { SFXGroupIndex::SFXEntryDNA entry; entry.read(r); @@ -496,7 +513,7 @@ void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, GCNData } } - r.seek(header.groupEndOff, athena::Begin); + r.seek(header.groupEndOff, athena::SeekOrigin::Begin); } } @@ -511,67 +528,73 @@ void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, bool ab GroupId::CurNameDB->registerPair(NameDB::generateName(header.groupId, NameDB::Type::Group), header.groupId); /* Sound Macros */ - r.seek(subDataOff + header.soundMacroIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(subDataOff + header.soundMacroIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); + } /* Samples */ - r.seek(subDataOff + header.samplIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(subDataOff + header.samplIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + } /* Tables */ - r.seek(subDataOff + header.tableIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(subDataOff + header.tableIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + } /* Keymaps */ - r.seek(subDataOff + header.keymapIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(subDataOff + header.keymapIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + } /* Layers */ - r.seek(subDataOff + header.layerIdsOff, athena::Begin); - while (!AtEnd16(r)) + r.seek(subDataOff + header.layerIdsOff, athena::SeekOrigin::Begin); + while (!AtEnd16(r)) { ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + } if (header.type == GroupType::Song) { /* MIDI setups */ if (absOffs) { - r.seek(header.midiSetupsOff, athena::Begin); + r.seek(header.midiSetupsOff, athena::SeekOrigin::Begin); while (r.position() < header.groupEndOff) { uint16_t id; athena::io::Read::Do({}, id, r); SongId::CurNameDB->registerPair(NameDB::generateName(id, NameDB::Type::Song), id); - r.seek(2 + 5 * 16, athena::Current); + r.seek(2 + 5 * 16, athena::SeekOrigin::Current); } } else { - r.seek(subDataOff + header.midiSetupsOff, athena::Begin); + r.seek(subDataOff + header.midiSetupsOff, athena::SeekOrigin::Begin); while (atInt64(r.position()) < groupBegin + header.groupEndOff) { uint16_t id; athena::io::Read::Do({}, id, r); SongId::CurNameDB->registerPair(NameDB::generateName(id, NameDB::Type::Song), id); - r.seek(2 + 8 * 16, athena::Current); + r.seek(2 + 8 * 16, athena::SeekOrigin::Current); } } } else if (header.type == GroupType::SFX) { /* SFX entries */ - r.seek(subDataOff + header.pageTableOff, athena::Begin); + r.seek(subDataOff + header.pageTableOff, athena::SeekOrigin::Begin); uint16_t count; athena::io::Read::Do({}, count, r); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); for (int i = 0; i < count; ++i) { SFXGroupIndex::SFXEntryDNA entry; entry.read(r); - r.seek(2, athena::Current); + r.seek(2, athena::SeekOrigin::Current); SFXId::CurNameDB->registerPair(NameDB::generateName(entry.sfxId.id, NameDB::Type::SFX), entry.sfxId.id); } } - if (absOffs) - r.seek(header.groupEndOff, athena::Begin); - else - r.seek(groupBegin + header.groupEndOff, athena::Begin); + if (absOffs) { + r.seek(header.groupEndOff, athena::SeekOrigin::Begin); + } else { + r.seek(groupBegin + header.groupEndOff, athena::SeekOrigin::Begin); + } } } @@ -861,9 +884,9 @@ std::vector AudioGroupProject::toGCNData(const AudioGroupPool& pool, } header.groupEndOff = fo.position(); - fo.seek(groupStart, athena::Begin); + fo.seek(groupStart, athena::SeekOrigin::Begin); header.write(fo); - fo.seek(header.groupEndOff, athena::Begin); + fo.seek(header.groupEndOff, athena::SeekOrigin::Begin); } else { auto search2 = m_sfxGroups.find(id); if (search2 != m_sfxGroups.end()) { @@ -897,9 +920,9 @@ std::vector AudioGroupProject::toGCNData(const AudioGroupPool& pool, } header.groupEndOff = fo.position(); - fo.seek(groupStart, athena::Begin); + fo.seek(groupStart, athena::SeekOrigin::Begin); header.write(fo); - fo.seek(header.groupEndOff, athena::Begin); + fo.seek(header.groupEndOff, athena::SeekOrigin::Begin); } } } diff --git a/lib/AudioGroupSampleDirectory.cpp b/lib/AudioGroupSampleDirectory.cpp index 099833d..6f904a3 100644 --- a/lib/AudioGroupSampleDirectory.cpp +++ b/lib/AudioGroupSampleDirectory.cpp @@ -24,7 +24,7 @@ namespace amuse { static bool AtEnd32(athena::io::IStreamReader& r) { uint32_t v = r.readUint32Big(); - r.seek(-4, athena::Current); + r.seek(-4, athena::SeekOrigin::Current); return v == 0xffffffff; } @@ -55,7 +55,7 @@ AudioGroupSampleDirectory::AudioGroupSampleDirectory(athena::io::IStreamReader& for (auto& p : m_entries) { if (p.second->m_data->m_adpcmParmOffset) { - r.seek(p.second->m_data->m_adpcmParmOffset, athena::Begin); + r.seek(p.second->m_data->m_adpcmParmOffset, athena::SeekOrigin::Begin); r.readUBytesToBuf(&p.second->m_data->m_ADPCMParms, sizeof(ADPCMParms::DSPParms)); p.second->m_data->m_ADPCMParms.swapBigDSP(); } @@ -237,7 +237,7 @@ void AudioGroupSampleDirectory::EntryData::loadLooseWAV(SystemStringView wavPath m_looseData.reset(new uint8_t[chunkSize]); r.readUBytesToBuf(m_looseData.get(), chunkSize); } - r.seek(startPos + chunkSize, athena::Begin); + r.seek(startPos + chunkSize, athena::SeekOrigin::Begin); } } } @@ -388,7 +388,7 @@ void AudioGroupSampleDirectory::EntryData::patchMetadataDSP(SystemStringView dsp athena::io::FileWriter w(dspPath, false); if (!w.hasError()) { - w.seek(0, athena::Begin); + w.seek(0, athena::SeekOrigin::Begin); head.write(w); } } @@ -397,7 +397,7 @@ void AudioGroupSampleDirectory::EntryData::patchMetadataDSP(SystemStringView dsp void AudioGroupSampleDirectory::EntryData::patchMetadataVADPCM(SystemStringView vadpcmPath) { athena::io::FileWriter w(vadpcmPath, false); if (!w.hasError()) { - w.seek(0, athena::Begin); + w.seek(0, athena::SeekOrigin::Begin); VADPCMHeader header; header.m_pitchSampleRate = m_pitch << 24; header.m_pitchSampleRate |= m_sampleRate & 0xffff; @@ -434,12 +434,12 @@ void AudioGroupSampleDirectory::EntryData::patchMetadataWAV(SystemStringView wav loopOffset = startPos + 36; ++readSec; } - r.seek(startPos + chunkSize, athena::Begin); + r.seek(startPos + chunkSize, athena::SeekOrigin::Begin); } if (smplOffset == -1 || loopOffset == -1) { /* Complete rewrite of RIFF layout - new smpl chunk */ - r.seek(12, athena::Begin); + r.seek(12, athena::SeekOrigin::Begin); athena::io::FileWriter w(wavPath); if (!w.hasError()) { w.writeUint32Little(SBIG('RIFF')); @@ -470,7 +470,7 @@ void AudioGroupSampleDirectory::EntryData::patchMetadataWAV(SystemStringView wav loop.end = getLoopEndSample(); loop.write(w); if (chunkMagic == SBIG('smpl')) { - r.seek(chunkSize, athena::Current); + r.seek(chunkSize, athena::SeekOrigin::Current); continue; } } @@ -480,7 +480,7 @@ void AudioGroupSampleDirectory::EntryData::patchMetadataWAV(SystemStringView wav } atUint64 wavLen = w.position(); - w.seek(4, athena::Begin); + w.seek(4, athena::SeekOrigin::Begin); w.writeUint32Little(wavLen - 8); } r.close(); @@ -489,7 +489,7 @@ void AudioGroupSampleDirectory::EntryData::patchMetadataWAV(SystemStringView wav r.close(); athena::io::FileWriter w(wavPath, false); if (!w.hasError()) { - w.seek(smplOffset, athena::Begin); + w.seek(smplOffset, athena::SeekOrigin::Begin); WAVSampleChunk smpl; smpl.smplPeriod = 1000000000 / fmt.sampleRate; smpl.midiNote = m_pitch; @@ -810,7 +810,7 @@ void AudioGroupSampleDirectory::_extractCompressed(SampleId id, const EntryData& samps += sampleCount; } - w.seek(0, athena::Begin); + w.seek(0, athena::SeekOrigin::Begin); header.write(w); } else { return; From b6f0201fbb018e1fb01c513abbc49a4ae1fb86af Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 8 Sep 2019 17:02:36 -0400 Subject: [PATCH 2/2] General: Be explicit about athena's Endian type Allows this code to still compile if the enum is ever changed into an enum class. --- Editor/ProjectModel.cpp | 16 ++++--- Editor/SoundMacroEditor.cpp | 13 +++--- include/amuse/AudioGroupPool.hpp | 56 +++++++++++----------- include/amuse/AudioGroupProject.hpp | 4 +- include/amuse/Common.hpp | 8 ++-- lib/AudioGroupPool.cpp | 22 ++++----- lib/AudioGroupProject.cpp | 42 ++++++++--------- lib/AudioGroupSampleDirectory.cpp | 12 ++--- lib/Common.cpp | 72 ++++++++++++++--------------- lib/SoundMacroState.cpp | 8 ++-- 10 files changed, 129 insertions(+), 124 deletions(-) diff --git a/Editor/ProjectModel.cpp b/Editor/ProjectModel.cpp index 8d0a733..804128e 100644 --- a/Editor/ProjectModel.cpp +++ b/Editor/ProjectModel.cpp @@ -67,18 +67,22 @@ static void VisitObjectFields(ProjectModel::SoundMacroNode* n, break; switch (field.m_tp) { case amuse::SoundMacro::CmdIntrospection::Field::Type::SoundMacroId: - if (!func(amuse::AccessField>(p.get(), field).id, - amuse::SoundMacroId::CurNameDB)) + if (!func(amuse::AccessField>(p.get(), field).id, + amuse::SoundMacroId::CurNameDB)) { return; + } break; case amuse::SoundMacro::CmdIntrospection::Field::Type::TableId: - if (!func(amuse::AccessField>(p.get(), field).id, amuse::TableId::CurNameDB)) + if (!func(amuse::AccessField>(p.get(), field).id, + amuse::TableId::CurNameDB)) { return; + } break; case amuse::SoundMacro::CmdIntrospection::Field::Type::SampleId: - if (!func(amuse::AccessField>(p.get(), field).id, - amuse::SampleId::CurNameDB)) + if (!func(amuse::AccessField>(p.get(), field).id, + amuse::SampleId::CurNameDB)) { return; + } break; default: break; @@ -720,7 +724,7 @@ bool ProjectModel::exportGroup(const QString& path, const QString& groupName, UI fo.writeUBytes(proj.data(), proj.size()); } { - auto pool = group.getPool().toData(); + auto pool = group.getPool().toData(); athena::io::FileWriter fo(QStringToSysString(basePath + QStringLiteral(".pool"))); if (fo.hasError()) { messenger.critical(tr("Export Error"), tr("Unable to export %1.pool").arg(groupName)); diff --git a/Editor/SoundMacroEditor.cpp b/Editor/SoundMacroEditor.cpp index d99f4fa..97c0e3f 100644 --- a/Editor/SoundMacroEditor.cpp +++ b/Editor/SoundMacroEditor.cpp @@ -219,8 +219,8 @@ CommandWidget::CommandWidget(QWidget* parent, amuse::SoundMacro::ICmd* cmd, amus nf = new FieldProjectNode(collection, this); nf->setProperty("fieldIndex", f); nf->setProperty("fieldName", fieldName); - int index = - collection->indexOfId(amuse::AccessField>(m_cmd, field).id); + const int index = collection->indexOfId( + amuse::AccessField>(m_cmd, field).id); nf->setCurrentIndex(index < 0 ? 0 : index + 1); connect(nf, &FieldProjectNode::currentIndexChanged, this, &CommandWidget::nodeChanged); layout->addWidget(nf, 1, f); @@ -231,7 +231,8 @@ CommandWidget::CommandWidget(QWidget* parent, amuse::SoundMacro::ICmd* cmd, amus sb->setFixedHeight(30); sb->setProperty("fieldIndex", f); sb->setProperty("fieldName", fieldName); - sb->m_spinBox.setValue(amuse::AccessField>(m_cmd, field).step); + sb->m_spinBox.setValue( + amuse::AccessField>(m_cmd, field).step); connect(sb, &FieldSoundMacroStep::valueChanged, this, &CommandWidget::numChanged); layout->addWidget(sb, 1, f); m_stepField = sb; @@ -315,7 +316,7 @@ public: case amuse::SoundMacro::CmdIntrospection::Field::Type::SoundMacroStep: case amuse::SoundMacro::CmdIntrospection::Field::Type::TableId: case amuse::SoundMacro::CmdIntrospection::Field::Type::SampleId: - amuse::AccessField>(m_cmd, m_field).id = uint16_t(m_undoVal); + amuse::AccessField>(m_cmd, m_field).id = uint16_t(m_undoVal); break; default: break; @@ -357,8 +358,8 @@ public: case amuse::SoundMacro::CmdIntrospection::Field::Type::SoundMacroStep: case amuse::SoundMacro::CmdIntrospection::Field::Type::TableId: case amuse::SoundMacro::CmdIntrospection::Field::Type::SampleId: - m_undoVal = amuse::AccessField>(m_cmd, m_field).id.id; - amuse::AccessField>(m_cmd, m_field).id = uint16_t(m_redoVal); + m_undoVal = amuse::AccessField>(m_cmd, m_field).id.id; + amuse::AccessField>(m_cmd, m_field).id = uint16_t(m_redoVal); break; default: break; diff --git a/include/amuse/AudioGroupPool.hpp b/include/amuse/AudioGroupPool.hpp index 20bd954..74374ba 100644 --- a/include/amuse/AudioGroupPool.hpp +++ b/include/amuse/AudioGroupPool.hpp @@ -180,8 +180,8 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Value key; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::SplitKey; } }; @@ -189,8 +189,8 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Value velocity; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::SplitVel; } }; @@ -212,7 +212,7 @@ struct SoundMacro { Value keyOff; Value random; Value sampleEnd; - SoundMacroStepDNA macroStep; + SoundMacroStepDNA macroStep; Value times; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::Loop; } @@ -221,8 +221,8 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Seek<1, athena::SeekOrigin::Current> dummy; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::Goto; } }; @@ -242,8 +242,8 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Value addNote; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; Value priority; Value maxVoices; bool Do(SoundMacroState& st, Voice& vox) const override; @@ -261,8 +261,8 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Value modValue; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::SplitMod; } }; @@ -278,7 +278,7 @@ struct SoundMacro { struct CmdSetAdsr : ICmd { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; - TableIdDNA table; + TableIdDNA table; Value dlsMode; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::SetAdsr; } @@ -288,7 +288,7 @@ struct SoundMacro { static const CmdIntrospection Introspective; Value scale; Value add; - TableIdDNA table; + TableIdDNA table; Value originalVol; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::ScaleVolume; } @@ -307,7 +307,7 @@ struct SoundMacro { static const CmdIntrospection Introspective; Value scale; Value add; - TableIdDNA table; + TableIdDNA table; Value msSwitch; Value ticksOrMs; bool Do(SoundMacroState& st, Voice& vox) const override; @@ -317,7 +317,7 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; enum class Mode : atInt8 { NoScale = 0, Negative = 1, Positive = 2 }; - SampleIdDNA sample; + SampleIdDNA sample; Value mode; Value offset; bool Do(SoundMacroState& st, Voice& vox) const override; @@ -339,8 +339,8 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Value rnd; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::SplitRnd; } }; @@ -349,7 +349,7 @@ struct SoundMacro { static const CmdIntrospection Introspective; Value scale; Value add; - TableIdDNA table; + TableIdDNA table; Value msSwitch; Value ticksOrMs; bool Do(SoundMacroState& st, Voice& vox) const override; @@ -477,7 +477,7 @@ struct SoundMacro { struct CmdSetPitchAdsr : ICmd { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; - TableIdDNA table; + TableIdDNA table; Seek<1, athena::SeekOrigin::Current> seek; Value keys; Value cents; @@ -519,8 +519,8 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Seek<1, athena::SeekOrigin::Current> seek; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::GoSub; } }; @@ -529,8 +529,8 @@ struct SoundMacro { static const CmdIntrospection Introspective; enum class EventType : atInt8 { KeyOff, SampleEnd, MessageRecv }; Value event; - SoundMacroIdDNA macro; - SoundMacroStepDNA macroStep; + SoundMacroIdDNA macro; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::TrapEvent; } }; @@ -545,7 +545,7 @@ struct SoundMacro { AT_DECL_DNA_YAMLV static const CmdIntrospection Introspective; Value isVar; - SoundMacroIdDNA macro; + SoundMacroIdDNA macro; Value voiceVar; Value valueVar; bool Do(SoundMacroState& st, Voice& vox) const override; @@ -921,7 +921,7 @@ struct SoundMacro { Value varCtrlB; Value b; Value notEq; - SoundMacroStepDNA macroStep; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::IfEqual; } }; @@ -933,7 +933,7 @@ struct SoundMacro { Value varCtrlB; Value b; Value notLt; - SoundMacroStepDNA macroStep; + SoundMacroStepDNA macroStep; bool Do(SoundMacroState& st, Voice& vox) const override; CmdOp Isa() const override { return CmdOp::IfLess; } }; @@ -1104,7 +1104,7 @@ struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) KeymapDN }; struct Keymap : BigDNA { AT_DECL_DNA_YAML - SoundMacroIdDNA macro; + SoundMacroIdDNA macro; Value transpose = 0; Value pan = 64; /* -128 for surround-channel only */ Value prioOffset = 0; @@ -1146,7 +1146,7 @@ struct AT_SPECIALIZE_PARMS(athena::Endian::Big, athena::Endian::Little) LayerMap }; struct LayerMapping : BigDNA { AT_DECL_DNA_YAML - SoundMacroIdDNA macro; + SoundMacroIdDNA macro; Value keyLo = 0; Value keyHi = 127; Value transpose = 0; diff --git a/include/amuse/AudioGroupProject.hpp b/include/amuse/AudioGroupProject.hpp index b3c92e1..5ebac8a 100644 --- a/include/amuse/AudioGroupProject.hpp +++ b/include/amuse/AudioGroupProject.hpp @@ -60,7 +60,7 @@ struct SongGroupIndex : AudioGroupIndex { }; struct PageEntry : BigDNA { AT_DECL_DNA_YAML - PageObjectIdDNA objId; + PageObjectIdDNA objId; Value priority = 0; Value maxVoices = 255; @@ -134,7 +134,7 @@ struct SFXGroupIndex : AudioGroupIndex { }; struct SFXEntry : BigDNA { AT_DECL_DNA_YAML - PageObjectIdDNA objId; + PageObjectIdDNA objId; Value priority = 0; Value maxVoices = 255; Value defVel = 127; diff --git a/include/amuse/Common.hpp b/include/amuse/Common.hpp index 5f6c558..3ac13a3 100644 --- a/include/amuse/Common.hpp +++ b/include/amuse/Common.hpp @@ -38,10 +38,10 @@ constexpr float NativeSampleRate = 32000.0f; namespace amuse { struct NameDB; -using BigDNA = athena::io::DNA; -using LittleDNA = athena::io::DNA; -using BigDNAV = athena::io::DNAVYaml; -using LittleDNAV = athena::io::DNAVYaml; +using BigDNA = athena::io::DNA; +using LittleDNA = athena::io::DNA; +using BigDNAV = athena::io::DNAVYaml; +using LittleDNAV = athena::io::DNAVYaml; /** Common ID structure statically tagging * SoundMacros, Tables, Keymaps, Layers, Samples, SFX, Songs */ diff --git a/lib/AudioGroupPool.cpp b/lib/AudioGroupPool.cpp index 574a523..4860fdd 100644 --- a/lib/AudioGroupPool.cpp +++ b/lib/AudioGroupPool.cpp @@ -67,7 +67,7 @@ struct MakeDefaultCmdOp { case amuse::SoundMacro::CmdIntrospection::Field::Type::SoundMacroStep: case amuse::SoundMacro::CmdIntrospection::Field::Type::TableId: case amuse::SoundMacro::CmdIntrospection::Field::Type::SampleId: - AccessField>(ret.get(), field).id = uint16_t(field.m_default); + AccessField>(ret.get(), field).id = uint16_t(field.m_default); break; default: break; @@ -188,8 +188,8 @@ AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r) { return ret; } -template AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r); -template AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r); +template AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r); +template AudioGroupPool AudioGroupPool::_AudioGroupPool(athena::io::IStreamReader& r); AudioGroupPool AudioGroupPool::CreateAudioGroupPool(const AudioGroupData& data) { if (data.getPoolSize() < 16) @@ -197,9 +197,9 @@ AudioGroupPool AudioGroupPool::CreateAudioGroupPool(const AudioGroupData& data) athena::io::MemoryReader r(data.getPool(), data.getPoolSize()); switch (data.getDataFormat()) { case DataFormat::PC: - return _AudioGroupPool(r); + return _AudioGroupPool(r); default: - return _AudioGroupPool(r); + return _AudioGroupPool(r); } } @@ -339,8 +339,8 @@ void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size) { m_cmds.push_back(CmdDo>(mr)); } } -template void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size); -template void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size); +template void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size); +template void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size); template void SoundMacro::writeCmds(athena::io::IStreamWriter& w) const { @@ -352,8 +352,8 @@ void SoundMacro::writeCmds(athena::io::IStreamWriter& w) const { athena::io::Write::Do({}, data, w); } } -template void SoundMacro::writeCmds(athena::io::IStreamWriter& w) const; -template void SoundMacro::writeCmds(athena::io::IStreamWriter& w) const; +template void SoundMacro::writeCmds(athena::io::IStreamWriter& w) const; +template void SoundMacro::writeCmds(athena::io::IStreamWriter& w) const; void SoundMacro::buildFromPrototype(const SoundMacro& other) { m_cmds.reserve(other.m_cmds.size()); @@ -1101,8 +1101,8 @@ std::vector AudioGroupPool::toData() const { return fo.data(); } -template std::vector AudioGroupPool::toData() const; -template std::vector AudioGroupPool::toData() const; +template std::vector AudioGroupPool::toData() const; +template std::vector AudioGroupPool::toData() const; template <> void amuse::Curve::Enumerate(athena::io::IStreamReader& r) { diff --git a/lib/AudioGroupProject.cpp b/lib/AudioGroupProject.cpp index 21fd65f..dc29261 100644 --- a/lib/AudioGroupProject.cpp +++ b/lib/AudioGroupProject.cpp @@ -82,7 +82,7 @@ static void WriteRangedObjectIds(athena::io::IStreamWriter& w, const T& list) { AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { while (!AtEnd32(r)) { - GroupHeader header; + GroupHeader header; header.read(r); if (GroupId::CurNameDB) @@ -92,31 +92,31 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { /* Sound Macros */ r.seek(header.soundMacroIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); + ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); } /* Samples */ r.seek(header.samplIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); } /* Tables */ r.seek(header.tableIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); } /* Keymaps */ r.seek(header.keymapIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); } /* Layers */ r.seek(header.layerIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); } #endif @@ -127,7 +127,7 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { /* Normal pages */ r.seek(header.pageTableOff, athena::SeekOrigin::Begin); while (!AtEnd64(r)) { - SongGroupIndex::PageEntryDNA entry; + SongGroupIndex::PageEntryDNA entry; entry.read(r); idx->m_normPages[entry.programNo] = entry; } @@ -135,7 +135,7 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { /* Drum pages */ r.seek(header.drumTableOff, athena::SeekOrigin::Begin); while (!AtEnd64(r)) { - SongGroupIndex::PageEntryDNA entry; + SongGroupIndex::PageEntryDNA entry; entry.read(r); idx->m_drumPages[entry.programNo] = entry; } @@ -163,7 +163,7 @@ AudioGroupProject::AudioGroupProject(athena::io::IStreamReader& r, GCNDataTag) { r.seek(2, athena::SeekOrigin::Current); idx->m_sfxEntries.reserve(count); for (int i = 0; i < count; ++i) { - SFXGroupIndex::SFXEntryDNA entry; + SFXGroupIndex::SFXEntryDNA entry; entry.read(r); idx->m_sfxEntries[entry.sfxId.id] = entry; if (SFXId::CurNameDB) @@ -321,9 +321,9 @@ AudioGroupProject AudioGroupProject::CreateAudioGroupProject(const AudioGroupDat default: return AudioGroupProject(r, GCNDataTag{}); case DataFormat::N64: - return _AudioGroupProject(r, data.getAbsoluteProjOffsets()); + return _AudioGroupProject(r, data.getAbsoluteProjOffsets()); case DataFormat::PC: - return _AudioGroupProject(r, data.getAbsoluteProjOffsets()); + return _AudioGroupProject(r, data.getAbsoluteProjOffsets()); } } @@ -459,7 +459,7 @@ AudioGroupProject AudioGroupProject::CreateAudioGroupProject(const AudioGroupPro void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, GCNDataTag) { while (!AtEnd32(r)) { - GroupHeader header; + GroupHeader header; header.read(r); GroupId::CurNameDB->registerPair(NameDB::generateName(header.groupId, NameDB::Type::Group), header.groupId); @@ -467,30 +467,30 @@ void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, GCNData /* Sound Macros */ r.seek(header.soundMacroIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) - ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); + ReadRangedObjectIds(SoundMacroId::CurNameDB, r, NameDB::Type::SoundMacro); /* Samples */ r.seek(header.samplIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); + ReadRangedObjectIds(SampleId::CurNameDB, r, NameDB::Type::Sample); } /* Tables */ r.seek(header.tableIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); + ReadRangedObjectIds(TableId::CurNameDB, r, NameDB::Type::Table); } /* Keymaps */ r.seek(header.keymapIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); + ReadRangedObjectIds(KeymapId::CurNameDB, r, NameDB::Type::Keymap); } /* Layers */ r.seek(header.layerIdsOff, athena::SeekOrigin::Begin); while (!AtEnd16(r)) { - ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); + ReadRangedObjectIds(LayersId::CurNameDB, r, NameDB::Type::Layer); } if (header.type == GroupType::Song) { @@ -507,7 +507,7 @@ void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, GCNData uint16_t count = r.readUint16Big(); r.seek(2, athena::SeekOrigin::Current); for (int i = 0; i < count; ++i) { - SFXGroupIndex::SFXEntryDNA entry; + SFXGroupIndex::SFXEntryDNA entry; entry.read(r); SFXId::CurNameDB->registerPair(NameDB::generateName(entry.sfxId.id, NameDB::Type::SFX), entry.sfxId.id); } @@ -606,10 +606,10 @@ void AudioGroupProject::BootstrapObjectIDs(const AudioGroupData& data) { BootstrapObjectIDs(r, GCNDataTag{}); break; case DataFormat::N64: - BootstrapObjectIDs(r, data.getAbsoluteProjOffsets()); + BootstrapObjectIDs(r, data.getAbsoluteProjOffsets()); break; case DataFormat::PC: - BootstrapObjectIDs(r, data.getAbsoluteProjOffsets()); + BootstrapObjectIDs(r, data.getAbsoluteProjOffsets()); break; } } @@ -820,7 +820,7 @@ struct ObjectIdPool std::vector AudioGroupProject::toGCNData(const AudioGroupPool& pool, const AudioGroupSampleDirectory& sdir) const { - constexpr athena::Endian DNAE = athena::Big; + constexpr athena::Endian DNAE = athena::Endian::Big; athena::io::VectorWriter fo; diff --git a/lib/AudioGroupSampleDirectory.cpp b/lib/AudioGroupSampleDirectory.cpp index 6f904a3..061fbef 100644 --- a/lib/AudioGroupSampleDirectory.cpp +++ b/lib/AudioGroupSampleDirectory.cpp @@ -46,7 +46,7 @@ void AudioGroupSampleDirectory::ADPCMParms::swapBigVADPCM() { AudioGroupSampleDirectory::AudioGroupSampleDirectory(athena::io::IStreamReader& r, GCNDataTag) { while (!AtEnd32(r)) { - EntryDNA ent; + EntryDNA ent; ent.read(r); m_entries[ent.m_sfxId] = MakeObj(ent); if (SampleId::CurNameDB) @@ -66,14 +66,14 @@ AudioGroupSampleDirectory::AudioGroupSampleDirectory(athena::io::IStreamReader& bool absOffs, N64DataTag) { if (absOffs) { while (!AtEnd32(r)) { - MusyX1AbsSdirEntry ent; + MusyX1AbsSdirEntry ent; ent.read(r); m_entries[ent.m_sfxId] = MakeObj(ent); SampleId::CurNameDB->registerPair(NameDB::generateName(ent.m_sfxId, NameDB::Type::Sample), ent.m_sfxId); } } else { while (!AtEnd32(r)) { - MusyX1SdirEntry ent; + MusyX1SdirEntry ent; ent.read(r); m_entries[ent.m_sfxId] = MakeObj(ent); SampleId::CurNameDB->registerPair(NameDB::generateName(ent.m_sfxId, NameDB::Type::Sample), ent.m_sfxId); @@ -89,7 +89,7 @@ AudioGroupSampleDirectory::AudioGroupSampleDirectory(athena::io::IStreamReader& AudioGroupSampleDirectory::AudioGroupSampleDirectory(athena::io::IStreamReader& r, bool absOffs, PCDataTag) { if (absOffs) { while (!AtEnd32(r)) { - MusyX1AbsSdirEntry ent; + MusyX1AbsSdirEntry ent; ent.read(r); auto& store = m_entries[ent.m_sfxId]; store = MakeObj(ent); @@ -98,7 +98,7 @@ AudioGroupSampleDirectory::AudioGroupSampleDirectory(athena::io::IStreamReader& } } else { while (!AtEnd32(r)) { - MusyX1SdirEntry ent; + MusyX1SdirEntry ent; ent.read(r); auto& store = m_entries[ent.m_sfxId]; store = MakeObj(ent); @@ -877,7 +877,7 @@ void AudioGroupSampleDirectory::reloadSampleData(SystemStringView groupPath) { std::pair, std::vector> AudioGroupSampleDirectory::toGCNData(const AudioGroupDatabase& group) const { - constexpr athena::Endian DNAE = athena::Big; + constexpr athena::Endian DNAE = athena::Endian::Big; athena::io::VectorWriter fo; athena::io::VectorWriter sfo; diff --git a/lib/Common.cpp b/lib/Common.cpp index 2822589..172d5ba 100644 --- a/lib/Common.cpp +++ b/lib/Common.cpp @@ -49,52 +49,52 @@ bool Copy(const SystemChar* from, const SystemChar* to) { thread_local NameDB* type::CurNameDB = nullptr; \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::IStreamReader & reader) { \ + void type##DNA::Enumerate(athena::io::IStreamReader& reader) { \ id = reader.readUint16Little(); \ } \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::IStreamWriter & writer) { \ + void type##DNA::Enumerate(athena::io::IStreamWriter& writer) { \ writer.writeUint16Little(id.id); \ } \ template <> \ template <> \ - void type##DNA::Enumerate(size_t & sz) { \ + void type##DNA::Enumerate(size_t& sz) { \ sz += 2; \ } \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::YAMLDocReader & reader) { \ + void type##DNA::Enumerate(athena::io::YAMLDocReader& reader) { \ _read(reader); \ } \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::YAMLDocWriter & writer) { \ + void type##DNA::Enumerate(athena::io::YAMLDocWriter& writer) { \ _write(writer); \ } \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::IStreamReader & reader) { \ + void type##DNA::Enumerate(athena::io::IStreamReader& reader) { \ id = reader.readUint16Big(); \ } \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::IStreamWriter & writer) { \ + void type##DNA::Enumerate(athena::io::IStreamWriter& writer) { \ writer.writeUint16Big(id.id); \ } \ template <> \ template <> \ - void type##DNA::Enumerate(size_t & sz) { \ + void type##DNA::Enumerate(size_t& sz) { \ sz += 2; \ } \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::YAMLDocReader & reader) { \ + void type##DNA::Enumerate(athena::io::YAMLDocReader& reader) { \ _read(reader); \ } \ template <> \ template <> \ - void type##DNA::Enumerate(athena::io::YAMLDocWriter & writer) { \ + void type##DNA::Enumerate(athena::io::YAMLDocWriter& writer) { \ _write(writer); \ } \ template \ @@ -122,8 +122,8 @@ bool Copy(const SystemChar* from, const SystemChar* to) { const char* type##DNA::DNAType() { \ return "amuse::" #type "DNA"; \ } \ - template struct type##DNA; \ - template struct type##DNA; + template struct type##DNA; \ + template struct type##DNA; DEFINE_ID_TYPE(ObjectId, "object") DEFINE_ID_TYPE(SoundMacroId, "SoundMacro") @@ -137,52 +137,52 @@ DEFINE_ID_TYPE(GroupId, "group") template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::IStreamReader& reader) { +void PageObjectIdDNA::Enumerate(athena::io::IStreamReader& reader) { id = reader.readUint16Little(); } template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::IStreamWriter& writer) { +void PageObjectIdDNA::Enumerate(athena::io::IStreamWriter& writer) { writer.writeUint16Little(id.id); } template <> template <> -void PageObjectIdDNA::Enumerate(size_t& sz) { +void PageObjectIdDNA::Enumerate(size_t& sz) { sz += 2; } template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::YAMLDocReader& reader) { +void PageObjectIdDNA::Enumerate(athena::io::YAMLDocReader& reader) { _read(reader); } template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::YAMLDocWriter& writer) { +void PageObjectIdDNA::Enumerate(athena::io::YAMLDocWriter& writer) { _write(writer); } template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::IStreamReader& reader) { +void PageObjectIdDNA::Enumerate(athena::io::IStreamReader& reader) { id = reader.readUint16Big(); } template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::IStreamWriter& writer) { +void PageObjectIdDNA::Enumerate(athena::io::IStreamWriter& writer) { writer.writeUint16Big(id.id); } template <> template <> -void PageObjectIdDNA::Enumerate(size_t& sz) { +void PageObjectIdDNA::Enumerate(size_t& sz) { sz += 2; } template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::YAMLDocReader& reader) { +void PageObjectIdDNA::Enumerate(athena::io::YAMLDocReader& reader) { _read(reader); } template <> template <> -void PageObjectIdDNA::Enumerate(athena::io::YAMLDocWriter& writer) { +void PageObjectIdDNA::Enumerate(athena::io::YAMLDocWriter& writer) { _write(writer); } template @@ -232,65 +232,65 @@ template const char* PageObjectIdDNA::DNAType() { return "amuse::PageObjectIdDNA"; } -template struct PageObjectIdDNA; -template struct PageObjectIdDNA; +template struct PageObjectIdDNA; +template struct PageObjectIdDNA; template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::IStreamReader& reader) { +void SoundMacroStepDNA::Enumerate(athena::io::IStreamReader& reader) { step = reader.readUint16Little(); } template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::IStreamWriter& writer) { +void SoundMacroStepDNA::Enumerate(athena::io::IStreamWriter& writer) { writer.writeUint16Little(step); } template <> template <> -void SoundMacroStepDNA::Enumerate(size_t& sz) { +void SoundMacroStepDNA::Enumerate(size_t& sz) { sz += 2; } template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocReader& reader) { +void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocReader& reader) { step = reader.readUint16(nullptr); } template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocWriter& writer) { +void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocWriter& writer) { writer.writeUint16(nullptr, step); } template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::IStreamReader& reader) { +void SoundMacroStepDNA::Enumerate(athena::io::IStreamReader& reader) { step = reader.readUint16Big(); } template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::IStreamWriter& writer) { +void SoundMacroStepDNA::Enumerate(athena::io::IStreamWriter& writer) { writer.writeUint16Big(step); } template <> template <> -void SoundMacroStepDNA::Enumerate(size_t& sz) { +void SoundMacroStepDNA::Enumerate(size_t& sz) { sz += 2; } template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocReader& reader) { +void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocReader& reader) { step = reader.readUint16(nullptr); } template <> template <> -void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocWriter& writer) { +void SoundMacroStepDNA::Enumerate(athena::io::YAMLDocWriter& writer) { writer.writeUint16(nullptr, step); } template const char* SoundMacroStepDNA::DNAType() { return "amuse::SoundMacroStepDNA"; } -template struct SoundMacroStepDNA; -template struct SoundMacroStepDNA; +template struct SoundMacroStepDNA; +template struct SoundMacroStepDNA; ObjectId NameDB::generateId(Type tp) const { uint16_t maxMatch = 0; diff --git a/lib/SoundMacroState.cpp b/lib/SoundMacroState.cpp index fd8b86d..bf31ac3 100644 --- a/lib/SoundMacroState.cpp +++ b/lib/SoundMacroState.cpp @@ -163,19 +163,19 @@ constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType() { return SoundMacro::CmdIntrospection::Field::Type::UInt32; } template <> -constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { +constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { return SoundMacro::CmdIntrospection::Field::Type::SoundMacroId; } template <> -constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { +constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { return SoundMacro::CmdIntrospection::Field::Type::SoundMacroStep; } template <> -constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { +constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { return SoundMacro::CmdIntrospection::Field::Type::TableId; } template <> -constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { +constexpr SoundMacro::CmdIntrospection::Field::Type GetFieldType>() { return SoundMacro::CmdIntrospection::Field::Type::SampleId; }