Changes

→‎Custom audio: + editing audio, tradeoff of audio streaming
Line 1,256: Line 1,256:     
===Custom audio===
 
===Custom audio===
You can now add custom [[Modding:Audio|music or sounds]] to the game by editing the <samp>Data/AudioCueModificationData</samp> asset. These are added to the game's soundbank, so they can be used anywhere normal audio can be used (e.g. the <samp>Music</samp> [[Modding:Maps|map property]]).
+
You can now add custom [[Modding:Audio|music or sounds]] to the game by editing the <samp>Data/AudioCueModificationData</samp> asset. This can be used both to add new music tracks, and to replace existing tracks with new audio. These are added to the game's soundbank, so they can be used anywhere normal audio can be used (e.g. the <samp>Music</samp> [[Modding:Maps|map property]]).
    
====Format====
 
====Format====
Line 1,270: Line 1,270:  
|-
 
|-
 
| <samp>FilePaths</samp>
 
| <samp>FilePaths</samp>
| A list of file paths (not asset names) from which to load the audio track, relative to the game's <samp>Content</samp> folder. Each file can be <samp>.ogg</samp> or <samp>.wav</samp>. If you list multiple paths, a random one will be chosen each time it's played.
+
| ''(Optional if editing a track, required if adding a new one)'' A list of file paths (not asset names) from which to load the audio track, relative to the game's <samp>Content</samp> folder. Each file can be <samp>.ogg</samp> or <samp>.wav</samp>. If you list multiple paths, a random one will be chosen each time it's played.
 
|-
 
|-
 
| <samp>Category</samp>
 
| <samp>Category</samp>
Line 1,277: Line 1,277:  
| <samp>StreamedVorbis</samp>
 
| <samp>StreamedVorbis</samp>
 
| ''(Optional)'' Whether the audio should be streamed from disk when it's played, instead of being loaded into memory ahead of time. This is only possible for [[wikipedia:Vorbis|Ogg Vorbis]] (<samp>.ogg</samp>) files, which otherwise will be decompressed in-memory on load. Default false.
 
| ''(Optional)'' Whether the audio should be streamed from disk when it's played, instead of being loaded into memory ahead of time. This is only possible for [[wikipedia:Vorbis|Ogg Vorbis]] (<samp>.ogg</samp>) files, which otherwise will be decompressed in-memory on load. Default false.
 +
 +
This is a tradeoff between memory usage and performance, so you should consider which value is best for each audio track:
 +
{| class="wikitable"
 +
|-
 +
! value
 +
! effect
 +
|-
 +
| <samp>true</samp>
 +
| Reduces memory usage when the audio track isn't active, but increases performance impact when it's played. Playing the audio multiple times will multiply the memory and performance impact while they're active, since each play will stream a new instance. Recommended for longer audio tracks (like music or ambient noise), or tracks that are rarely used in a specific scenario (e.g. a sound that only plays once in an event).
 +
|-
 +
| <samp>false</samp>
 +
| Increases memory usage (since it's fully loaded into memory), but reduces performance impact when it's played. It can be played any number of times without affecting memory or performance (it'll just play the cached audio). Recommended for sound effects, or short audio tracks that are played occasionally.
 +
|}
 
|-
 
|-
 
| <samp>Looped</samp>
 
| <samp>Looped</samp>
Line 1,284: Line 1,297:  
| ''(Optional)'' Whether to apply a [[wikipedia:Reverberation|reverb]] effect to the audio. Default false.
 
| ''(Optional)'' Whether to apply a [[wikipedia:Reverberation|reverb]] effect to the audio. Default false.
 
|}
 
|}
 +
 +
This describes a '''change''' applied to the soundbank. For example, you can specify only <samp>ID</samp> and <samp>Category</samp> to change the category for an existing music track without overwriting other values.
    
====Example====
 
====Example====
translators
8,447

edits