How does the audio work?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
TheShed
Posts: 2
Joined: Wed Oct 26, 2022 7:28 pm

How does the audio work?

Post by TheShed »

I need to hook the dialogues to a SO based AudioManager, but the inner workings on how the audio files are retrieved and played remains a mystery despite my best efforts, although and I think I've figured where it is played, but unsure about it.

Therefore I ask for assistance, a brief explanations of where and what things happen may be enough.

Thanks in advance.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: How does the audio work?

Post by Tony Li »

Hi,

Short answer: Write a sequencer command.

Longer answer:
The most common way to play audio in the Dialogue System is through a sequencer command. (See: Cutscene Sequences)

When the Dialogue System shows a dialogue entry node, it plays the node's Sequence. If the Sequence field is blank, it plays the Dialogue Manager GameObject's Display Settings > Camera & Cutscene Settings > Default Sequence. The conversation doesn't advance until the Sequence finishes playing. (Exception: If you've enabled continue buttons, it waits until the player clicks the continue button.)

A Sequence is a set of sequencer commands, each of which can do something like play audio, or move the camera, or start an animation, etc. In DemoScene1, the Dialogue Manager's Default Sequence runs this command:

Code: Select all

AudioWait(entrytag)
The AudioWait() command plays an audio clip and waits until it's done. The special keyword 'entrytag' is a string that uniquely identifies a dialogue entry node. It's common to name your audio clips by entrytag so you don't have to specify an audio clip name in every single node's Sequence. You can just use a Default Sequence like above. (This is covered in part 4 of the Cutscene Sequence Tutorials.) The AudioWait() command looks in Resources folders, assetbundles, and addressables for an audio clip with the specified name.

In your case, you'll want to write a similar command that plays audio through your SO-based AudioManager. Your command will probably be simpler than SequencerCommandAudioWait.cs since the AudioWait() command has extra options that you probably won't care about.
TheShed
Posts: 2
Joined: Wed Oct 26, 2022 7:28 pm

Re: How does the audio work?

Post by TheShed »

Great, thank you very much, I will study the code further.

However, I have idea how to input audio through the tool, the demo scene has a field for audio that recieves a file, but the file itself isnt shown in the Demo Scene.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: How does the audio work?

Post by Tony Li »

That Audio Files field is only used by Chat Mapper. If you're not using Chat Mapper, you can remove the field from your dialogue database template. Or you can write custom code to use it if you want.
Post Reply