Repository navigation
Conversation
A Sound box in SuperView plays the SOUND_TRIGGER tags of the clip meta, the persistent meta, the slot's .snd.meta and the persistent row's .snd.meta as the playhead crosses them. Each tag goes through audio_metadata_tags_tables to its battle event, then through the event's Play actions and containers to the WEMs, as the game resolves it: random and sequence containers follow their playlist rules, and each switch group the triggers reach gets a picker. Status lines say what the triggers resolve to and why one plays nothing. The sounds play through a small mixer of their own, as triggers overlap and SoundEngine plays one stream. Adds a DB table reader (Shared/GameFiles/DB) with the tags table's layouts from RPFM's schema, and makes AudioRepository's lookups and loads safe from two threads, as SuperView resolves off the UI thread.
Collaborator
|
Hello, this looks great but it might be worth holding on for now as I've got a separate implementation which handles the sound engine redesign to allow sounds to play concurrently and not lag behind animations. |
Contributor
Author
Copy that! 🫡 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hey, this one is for #354 (Audio for SuperView), and most of #356. SuperView gets a Sound box: tick it and the SOUND_TRIGGER tags play their sounds as the playhead crosses them, so you can hear footsteps, swooshes and grunts land on the frames they're tagged on
what plays
audio_metadata_tags_tablesrow for the tag (exact spelling, the copy the game keeps wins), its battle event, the event's Play actions, then down through the containers to the WEMs. random and sequence containers follow their playlist rules (weights, avoid repeat, shuffle, playlist order), switch containers play the case you pickthe status lines under the box say what the triggers resolve to: "N triggers: X play, Y silent in game, Z not supported", then one line per trigger that plays nothing, saying why. "silent in game" is a missing tags row, an event in no loaded bank, an event with no Play action and so on. "not supported" is a Wwise type this doesn't play (a dialogue event behind a 0x2303 action, which is what the melee hit sounds go through). it also lists a .snd.meta the slot names that no loaded pack has
it's off by default since turning it on loads the game's audio, and that's slow the first time after a game update (the audio cache gets built). the loading and decoding all happen off the UI thread, a vanilla attack's triggers can reach ~675 sources
why not SoundEngine
issue #356 says connect SuperView to SoundEngine, but triggers overlap all the time (a swoosh and a grunt at once, or the same footstep twice), and SoundEngine plays one stream. so this adds
SoundTriggerMixer: it decodes each WEM once the same way SoundEngine does (WEM to Ogg to float), resamples to 48 kHz stereo and mixes as many voices as fire, on its own output (WASAPI, falling back to WaveOut). happy to fold it into SoundEngine instead if you'd rather have one playback path, Pearthings to look at
Shared/GameFiles/DB(a small DB table reader:DbTableReader,DbSchema,DbTables) and changes nothing that's already there. the column layouts are an embedded extract of RPFM'sschema_wh3.ron, onlyaudio_metadata_tags_tables(versions 5 to 22).SchemaManageris commented out so there was nothing to hook into. if you'd rather keep GameFormats untouched I can move the three files into Editors.Audio, only the sound code uses them for nowDisposedoesn't wait for a load in progress, and a load that ends after it lets go of what it openedIAudioRepository(it's scoped, so each SuperView has its own)AnimationPlayerViewModel.Looping(raised before Loop jumps back to frame 0, since that jump is a paused frame set and can't be told apart otherwise),SoundMetaData/PersistSoundMetaDataonSceneObject, andSoundMetaName/SoundMetaPersistNameonBinAnimationViewModel, set when a slot is pickedfiles
Editors/Audio/SoundTriggers/: new,AudioMetadataTags,SoundTriggerResolver,SoundTriggerSession,SoundTriggerCrossing,SoundTriggerMixerEditors/Audio/Shared/Storage/AudioRepository.cs: the locksEditors/MetaDataEditor/AnimationMeta/SuperView/SuperViewViewModel.Sound.cs: new, the SuperView sideSuperViewViewModel.cs,EditorView.xaml: the hooks and the Sound boxBinAnimationViewModel.cs,SceneObject.cs,SceneObjectEditor.cs,AnimationPlayerViewModel.cs: as aboveShared/GameFiles/DB/: new, the three reader filesShared/EmbeddedResources/Resources/Db/schema_wh3_extract.txt: newEditors/Audio/SoundTriggerTests.cs(new),AudioCacheTests.cs(the lock tests),Test.AnimationMeta/SuperViewSoundTests.cs,SoundTriggerGameTests.cs,AudioMetadataTagsTableTests.cs(new)testing
SoundTriggerTests(Test.Audio): the resolver on an in-memory bank, one case per Wwise action type, the playlist rules, the crossing rule (loop, paused steps, speed, the lead wrapping at the clip edge) and the mixer with a mocked device.AudioCacheTestsgets the repository lock tests. 137 passed, 0 failedSuperViewSoundTests(Test.AnimationMeta): SuperView on Throt's ATTACK_5 fromData/Throt.packwith the audio swapped for a small in-memory bank and the playback for recorders, so no device opens. covers all four files firing, the lead, looping, a slot change, edits while on, the switch pickers, a device that won't open or stops, and the Sound box bound in the view. 30 passedAudioMetadataTagsTableTests: the DB reader on made-up files (F64 column, truncated, trailing bytes, unknown version) and which copy of a row wins across packsSoundTriggerGameTests: the real game files, skipped withoutWH3_DATA. vanilla tags resolve to real WEMs, a made-up tag is silent, the melee hit sounds say not supported, and a real sword-and-shield attack's .snd.meta (16 triggers, 236 sources) resolves and decodes off the UI thread: about 3.5 s of first resolves and 12 s of decoding off it, 140 to 300 ms on it depending on load, most of which is SuperView's own scene update (~130 ms). the bar is 1 s, and running the jobs inline puts 16 s on it. all passWH3_DATAset: 2,738 results, 1 failed, 81 skipped (existing ignores, none from this PR). the failure was the game test asking the runner for the first editor's services instead of its own SuperView's; fixed, and Test.Audio (232 passed) and Test.AnimationMeta (230 passed) rerun cleanAssetEditor.csprojthe waypr-test.ymldoes, 0 errorsnot tried by hand in this build yet. the same feature shipped in my fork's v2.2 release on 11-21, with a Sound tab for editing the .snd.meta on top, which I left out here