random sound selection for triggers

This commit is contained in:
2026-01-06 16:26:57 -05:00
parent b41b6df19e
commit 5124f77817
12 changed files with 104 additions and 59 deletions
+7 -2
View File
@@ -204,8 +204,13 @@ namespace anm2ed::imgui
animation && animation->triggers.isVisible && (!isOnlyShowLayers || manager.isRecording))
{
if (auto trigger = animation->triggers.frame_generate(playback.time, anm2::TRIGGER); trigger.isVisible)
if (anm2.content.sounds.contains(trigger.soundID))
anm2.content.sounds[trigger.soundID].audio.play(false, mixer);
{
auto soundID = trigger.soundIDs.size() > 1
? (int)trigger.soundIDs[math::random_in_range(0, trigger.soundIDs.size())]
: (int)trigger.soundIDs.front();
if (anm2.content.sounds.contains(soundID)) anm2.content.sounds[soundID].audio.play(false, mixer);
}
}
}