/// <summary> /// Sets a playlist to a music player. /// </summary> /// <param name="player">Name of the music player.</param> /// <param name="playlist">Name of the playlist.</param> /// <param name="fade">Crossfade duration in seconds.</param> /// <remarks> /// <para>If multiple banks have music players/playlists with a matching name, primary music bank will be checked first. /// Within a bank, the first occurrence of found music player/playlist will be used.</para> /// <para>If music player was playing another track it'll automatically crossfade to first track of the new playlist.</para> /// <para>Crossfade parameter value will override <see cref="Stem.MusicPlayer"/>.<see cref="Stem.MusicPlayer.Fade"/> value.</para> /// </remarks> public static void SetPlaylist(string player, string playlist, float fade) { if (shutdown) { return; } MusicManagerRuntime runtime = bankManager.FetchRuntime(player); if (runtime != null) { runtime.SetPlaylist(player, playlist, fade); } }
/// <summary> /// Stops music player. /// </summary> /// <param name="player">Name of the music player.</param> /// <remarks> /// <para>If multiple banks have music players/playlists with a matching name, primary music bank will be checked first. /// Within a bank, the first occurrence of found music player/playlist will be used.</para> /// <para>This method does nothing if no playlist was assigned to the music player. Use <see cref="SetPlaylist(string, string)"/> or <see cref="SetPlaylist(string, string, float)"/> to assign a playlist.</para> /// </remarks> public static void Stop(string player) { if (shutdown) { return; } MusicManagerRuntime runtime = bankManager.FetchRuntime(player); if (runtime != null) { runtime.Stop(player); } }
/// <summary> /// Resumes music player. /// </summary> /// <param name="player">Name of the music player.</param> /// <param name="fade">Crossfade duration in seconds.</param> /// <remarks> /// <para>If multiple banks have music players/playlists with a matching name, primary music bank will be checked first. /// Within a bank, the first occurrence of found music player/playlist will be used.</para> /// <para>This method does nothing if no playlist was assigned to the music player. Use <see cref="SetPlaylist(string, string)"/> or <see cref="SetPlaylist(string, string, float)"/> to assign a playlist.</para> /// <para>Crossfade parameter value will override <see cref="Stem.MusicPlayer"/>.<see cref="Stem.MusicPlayer.Fade"/> value.</para> /// </remarks> public static void UnPause(string player, float fade) { if (shutdown) { return; } MusicManagerRuntime runtime = bankManager.FetchRuntime(player); if (runtime != null) { runtime.UnPause(player, fade); } }
/// <summary> /// Advances music player to a track with a matching name. /// </summary> /// <param name="player">Name of the music player.</param> /// <param name="track">Name of the track.</param> /// <remarks> /// <para>Target track must be one of current playlist tracks.</para> /// <para>If multiple banks have music players/playlists with a matching name, primary music bank will be checked first. /// Within a bank, the first occurrence of found music player/playlist will be used.</para> /// <para>This method does nothing if no playlist was assigned to the music player. Use <see cref="SetPlaylist(string, string)"/> or <see cref="SetPlaylist(string, string, float)"/> to assign a playlist.</para> /// </remarks> public static void Seek(string player, string track) { if (shutdown) { return; } MusicManagerRuntime runtime = bankManager.FetchRuntime(player); if (runtime != null) { runtime.Seek(player, track); } }