How does audio work in 2.0

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
chud575
Posts: 50
Joined: Thu May 11, 2017 10:57 am

How does audio work in 2.0

Post by chud575 »

Hi Tony,

I noticed in the v2 demo it auto loads audio files from the resources folder, and they seem to line up with the entrytag format, but other than that i cant figure out whats loading and playing them. Can you explain it please?
User avatar
Tony Li
Posts: 21061
Joined: Thu Jul 18, 2013 1:27 pm

Re: How does audio work in 2.0

Post by Tony Li »

Hi,

The Dialogue Manager's Display Settings > Camera & Cutscene Settings > Default Sequence is set to:

Code: Select all

AudioWait(entrytag)
Unimportant details:
Spoiler
In the demo, the Default Sequence is actually "AudioWait(entrytag); Delay({{end}})", but the Delay({{end}}) is unnecessary. It's left over from testing before I received the audio files.
The conversation nodes' Sequence fields are blank, which means they will use the Dialogue Manager's Default Sequence.

The AudioWait() sequencer command plays the audio clip specified by entrytag, which is a unique value for each node. It tries to load the audio clip from a Resources folder.

To get the entrytag values (i.e., audio clip filenames), I exported the database to a voiceover script. I sent this to the audio guy, who recorded the lines and used the entrytags as the filenames.
nrvllrgrs
Posts: 20
Joined: Wed Nov 11, 2015 4:55 pm

Re: How does audio work in 2.0

Post by nrvllrgrs »

Is it possible to load the audio files in a data structure specific to the level? I have an audio heavy game and I'd prefer not paying for it in memory.

Or is setting the clips to Streaming the best solution?
User avatar
Tony Li
Posts: 21061
Joined: Thu Jul 18, 2013 1:27 pm

Re: How does audio work in 2.0

Post by Tony Li »

Hi,

Using the Resources folder isn't required. It's just the default for convenience, since it's easy and it works well for most projects.

You can also use AssetBundles. Put each level's audio files in a separate AssetBundle. When you load the level, also load the AssetBundle and call DialogueManager.RegisterAssetBundle(). Sequencer commands like Audio() will automatically locate files in registered AssetBundles. You don't have to change how you use those commands at all. If the file isn't in any registered AssetBundles, it will look in Resources. When you unload the level, call DialogueManager.UnregisterAssetBundle().

You can also use DialogueManager.LoadAsset() for your own purposes to load any files of your own from registered AssetBundles.

If you prefer not to use AssetBundles, you can write your own sequencer commands to handle audio however you want.
Post Reply