|
Post by kalebgracetwistory on Jun 30, 2014 19:27:53 GMT
Hello! I'm using Master Audio and I'm enjoying a lot of the features.  I have a question about how to start the initial playlist from a PlaylistController class. I am not using the "Start Playlist on Awake" option because I need to start the initial playlist some time afterwards. Also, I need to call this through code and not through a game object/component event. However, there is no StartPlaylist or PlayPlaylist function. Am I missing something? So far I've only been able to start the playlist by calling ChangePlaylist and passing in the initial playlist name. In fact, I wrote a couple extension methods (one allows for initializing the volume, since it is modified dynamically by code). Maybe this will explain what I'm attempting to achieve. public static void StartPlaylist(this PlaylistController controller) { controller.StartPlaylist(-1f); }
public static void StartPlaylist(this PlaylistController controller, float volume) { string playlistName = controller.startPlaylistName; float playlistVolume;
if (volume >= 0f) { playlistVolume = volume; } else { playlistVolume = controller.playlistVolume; }
controller.ChangePlaylist(playlistName); controller.FadeToVolume(playlistVolume, 0f); } Let me know if you have any input on this. Thank you! 
|
|
|
Post by DarkTonic Dev on Jun 30, 2014 23:40:21 GMT
To "play" a Playlist that's loaded but not started, you can use the "PlayNextSong" or "PlayRandomSong" methods on the PlaylistController. If you don't have shuffle turned on, it would be PlayNextSong, otherwise the other one.
Hope that helps!
|
|
|
Post by kalebgracetwistory on Jul 24, 2014 0:00:43 GMT
Hi DarkTonic. Pardon the much late reply. I tried the methods you suggested but they don't work for me. When I start the game, no clip is selected in the playlists and no audio is playing. Auto-advance also makes no difference.
However, the code I provided in my last post works. Do you have any other possible leads as to why? Thanks!
|
|
|
Post by DarkTonic Dev on Jul 24, 2014 0:24:44 GMT
If you're calling that code during the Awake event (or possibly Start event), it's not reliable to work because of the order code runs in the Playlist Controller. However I fixed a bug regarding this, this week. So try again on the next released version of Master Audio (will be released sometime this week).
|
|