Advanced music control with MasterAudio

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
LewisFTG
Posts: 6
Joined: Sun Apr 15, 2018 5:49 am

Advanced music control with MasterAudio

Post by LewisFTG »

Hi all,
I'm trying to do some clever stuff with music playlists fading in and out at specific points in the dialogue, but haven't been successful in getting it to work yet. I want Track A to start, then have it fade out as Track B starts. Finally, I want to fade out Track B.

This is what I thought would work, but it doesn't stop or fade out Track B. Any idea why?

Node 1 Sequence:
MAChangePlaylist(Track A)

Node 2 Sequence:
MAFadePlaylist(Track A, 0, 5);
MAChangePlaylist(Track B)

Node 3 Sequence:
MAFadePlaylist(Track B, 0, 5);
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Advanced music control with MasterAudio

Post by nathanj »

I think the values of your Fade command are out of order.

The doc says:

Code: Select all

MAFadePlaylist(targetVolume, fadeTime, [playlistControllerName])
So you could try:

Code: Select all

MAFadePlaylist(0, 5,Track A);
But, now I'm not sure if that will work. The issue with the distinction between playlistName and playlistControllerName.

I think to achieve this you will need to make two playlists and use the MAFadePlaylist. There doesn't seem to be a way to route the individual audio files within a playlist to different mixer channels.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Advanced music control with MasterAudio

Post by Tony Li »

I'd wager that's the issue.

Try this:

Node 1 Sequence:
MAChangePlaylist(Track A, controller1)

Node 2 Sequence:
MAFadePlaylist(0, 5, controller1);
MAChangePlaylist(Track B, controller2);
MAFadePlaylist(1, 5, controller2);

Node 3 Sequence:
MAFadePlaylist(0, 5, all);

Note that, for the last MAFadePlaylist command, I specified 'all' for the last playlist controller. The third parameter is the name of a playlist controller (or 'all'), not the name of a playlist. Feel free to change this to the name of your playlist controller if you have multiple and only want to fade one. In the first two commands, I assumed you had two separate playlist controllers.

Here's some background on the possible confusion in the order of values: Master Audio was the very first Dialogue System integration. Back when it was written, the order of values in Master Audio's API was the same as the sequencer commands. Since then, Master Audio changed the order of values in its API. I didn't want to break everyone's sequences, so I left the sequencer commands with the original order of values.
LewisFTG
Posts: 6
Joined: Sun Apr 15, 2018 5:49 am

Re: Advanced music control with MasterAudio

Post by LewisFTG »

Great stuff! Thankyou Nathan and Tony.
Much appreciated!
Post Reply