Repository navigation
Play the published sound in place of the disc's packs - #252
Open
SirFancyBacon wants to merge 1 commit into
Open
SirFancyBacon wants to merge 1 commit into
SirFancyBacon wants to merge 1 commit into
Conversation
dcdata extract now publishes the sound in ChronicleTwo's formats as part of the bake, and the game plays it: as it loads a pack's load list it finds the pack's .sound.json, builds each bank from its bank.json and WAV samples and each sequence from its JSON through Kazarov's loaders, and takes the list's .cfg settings and the two volume tables from their documents. A pack without a document, or a file that cannot be read, plays the pack's own, as data the first-run window extracts does. The title's and the opening's packs hold their sound among their pictures and models, so a .pak that holds a load list naming its own banks or sequences is published too, its sequences named as a .snd's would be. Every published file is looked for in the active datapacks first, then in the data, through a vfs mount over the game's data reader, so a pack can replace a document, a bank, a sequence or one sample. The custom soundtrack still replaces a sequence by its name. The original packs are still extracted and read into memory before their lists are walked; a follow-up removes them. Recordings of the title, the opening, Norune and a dungeon floor are identical sample for sample from the published data and from the disc's packs.
This branch has not been deployed
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.
Follows up the sound publishing (
dcdata publish-sound, docs/AUDIO_FRAMEWORK.md): the published files were written but the game never played them. Now extraction publishes the sound and the game plays it.What changes
Extraction publishes the sound.
dcdata extractpublishes it after baking textures and models.dcdata publish-soundstill does it alone. Data from the first-run window has no published sound, as it has no baked textures or models, and plays the packs as before.The game plays the published files. When the game loads a pack's load list, it finds the pack's
.sound.jsonfrom the loaded bytes (DataReadSourceRange), so none of the 12 call sites change. Then it:bank.jsonand WAV samples with Kazarov'sBank::CreateFromJsonCandidates;SqFile::CreateFromJson;.cfgsettings (reverb, effect table) from the document;sqtbl,setbl) from their JSON.A pack without a document, or a list, member or file that can't be read, plays the pack's own as before. The new code is
port/src/sound/published.cpp.sound.cppandsnd.cppchange only where they use it; retail's walk of each load list stays as it is.Title and opening sound is published too. The title (in every language) and the opening keep their sound in
.pakpacks along with their pictures and models. A.pakis now published when it holds a load list naming its own banks or sequences; on the retail data that's 12 of them, intitledat/andopdat/. Kazarov names a pack's published sequences from a.sndpath, so a.pak's are keyed as if it were one (titledat/title.sound/sequences/…, besidetitledat/title.sound.json).Datapacks can replace sound. Every published file is looked up in the active datapacks first, then in the game's data. The data side goes through
data::DataMount(), a small read-only vfs mount over the game's data reader (folder ordata.zip). A pack can therefore replace a pack's document, a bank, a sequence or a single sample by its path. The custom soundtrack (docs/SOUNDTRACK.md) still replaces a sequence by its name, whichever source the sequence comes from.Not yet: removing the originals. The original packs are still extracted, and the game still reads each into memory before walking its lists. A follow-up removes them once the game no longer reads them.
Testing
DataRead.APacksPublishedSoundPlaysInPlaceOfItsOwn: a synthetic pack with a published document plays the published sequence and volume.DataRead.APackWithoutPublishedSoundPlaysItsOwn.DataRead.TheDataMountFindsAndReadsTheGamesFiles.SoundPublishRealDatapasses on the retail data with the.pakdocuments included: 230 packs sharing 230 banks, published in about 10 s.DC_AUDIO_WAV) from the retail data with and without the published files: the title, the opening, Norune and a dungeon floor with music and effects. All four pairs are identical sample for sample.ctest -j4passes on Linux, apart from the five Kazarov GPU tests that fail on lavapipe.