Class MusicManager
The main class for music playback and bank management.
Inheritance
Inherited Members
Namespace: Stem
Assembly: Stem.dll
Syntax
public static class MusicManager
Properties
| Improve this Doc View SourceBanks
The collection of all registered music banks.
Declaration
public static ReadOnlyCollection<MusicBank> Banks { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.ObjectModel.ReadOnlyCollection<MusicBank> | A reference to a read-only collection of music banks. |
PrimaryBank
The primary music bank that will be searched first in case of name collisions.
Declaration
public static MusicBank PrimaryBank { get; set; }
Property Value
| Type | Description |
|---|---|
| MusicBank | A reference to a primary music bank. |
Methods
| Improve this Doc View SourceDeregisterBank(MusicBank)
Deregisters existing music bank.
Declaration
public static bool DeregisterBank(MusicBank bank)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicBank | bank | A reference to a music bank to deregister. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if music bank was succesfully deregistered. False otherwise. |
GetMusicPlayer(ID)
Searches for the specified music player with a matching ID.
Declaration
public static MusicPlayer GetMusicPlayer(ID id)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | id | ID referring to the music player. |
Returns
| Type | Description |
|---|---|
| MusicPlayer | A reference to a music player, if found. Null reference otherwise. |
GetMusicPlayer(String)
Searches for the specified music player with a matching name.
Declaration
public static MusicPlayer GetMusicPlayer(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the music player. |
Returns
| Type | Description |
|---|---|
| MusicPlayer | A reference to a music player, if found. Null reference otherwise. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
GetPlaylist(ID)
Searches for the specified playlist with a matching ID.
Declaration
public static Playlist GetPlaylist(ID id)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | id | ID referring to the playlist. |
Returns
| Type | Description |
|---|---|
| Playlist | A reference to a playlist, if found. Null reference otherwise. |
GetPlaylist(String)
Searches for the specified playlist with a matching name.
Declaration
public static Playlist GetPlaylist(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the playlist. |
Returns
| Type | Description |
|---|---|
| Playlist | A reference to a playlist, if found. Null reference otherwise. |
Remarks
If multiple banks have playlists with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found playlist will be used.
IsPlaying(ID)
Checks whether or not specified music player with a matching ID is playing.
Declaration
public static bool IsPlaying(ID playerID)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if the found music player is playing. False otherwise. |
IsPlaying(String)
Checks whether or not specified music player with a matching name is playing.
Declaration
public static bool IsPlaying(string playerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if the found music player is playing. False otherwise. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
Next(ID)
Advances music player to next track.
Declaration
public static void Next(ID playerID)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Next(ID, Single)
Advances music player to next track.
Declaration
public static void Next(ID playerID, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Next(String)
Advances music player to next track.
Declaration
public static void Next(string playerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Next(String, Single)
Advances music player to next track.
Declaration
public static void Next(string playerName, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Pause(ID)
Pauses music player.
Declaration
public static void Pause(ID playerID)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Pause(ID, Single)
Pauses music player.
Declaration
public static void Pause(ID playerID, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Pause(String)
Pauses music player.
Declaration
public static void Pause(string playerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Pause(String, Single)
Pauses music player.
Declaration
public static void Pause(string playerName, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Play(ID)
Plays music player.
Declaration
public static void Play(ID playerID)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Play(ID, Single)
Plays music player.
Declaration
public static void Play(ID playerID, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Play(String)
Plays music player.
Declaration
public static void Play(string playerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Play(String, Single)
Plays music player.
Declaration
public static void Play(string playerName, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Prev(ID)
Advances music player to previous track.
Declaration
public static void Prev(ID playerID)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Prev(ID, Single)
Advances music player to previous track.
Declaration
public static void Prev(ID playerID, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Prev(String)
Advances music player to previous track.
Declaration
public static void Prev(string playerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Prev(String, Single)
Advances music player to previous track.
Declaration
public static void Prev(string playerName, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
RegisterBank(MusicBank)
Registers new music bank.
Declaration
public static bool RegisterBank(MusicBank bank)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicBank | bank | A reference to a music bank to register. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if music bank was succesfully registered. False otherwise. |
Seek(ID, Int32)
Advances music player to a track by index.
Declaration
public static void Seek(ID playerID, int track)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.Int32 | track | Zero-based index of the track in the current playlist. |
Remarks
Target track must be one of current playlist tracks.
The index value represents track order as they appear in the playlist (e.g. setting index to one will seek to the second playlist track and so on). Shuffle order is ignored.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Seek(ID, Int32, Single)
Advances music player to a track by index.
Declaration
public static void Seek(ID playerID, int track, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.Int32 | track | Zero-based index of the track in the current playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
Target track must be one of current playlist tracks.
The index value represents track order as they appear in the playlist (e.g. setting index to one will seek to the second playlist track and so on). Shuffle order is ignored.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Seek(ID, String)
Advances music player to a track with a matching name.
Declaration
public static void Seek(ID playerID, string track)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.String | track | Name of the track in the current playlist. |
Remarks
Target track must be one of current playlist tracks.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Seek(ID, String, Single)
Advances music player to a track with a matching name.
Declaration
public static void Seek(ID playerID, string track, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.String | track | Name of the track in the current playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
Target track must be one of current playlist tracks.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Seek(String, Int32)
Advances music player to a track by index.
Declaration
public static void Seek(string playerName, int track)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.Int32 | track | Zero-based index of the track in the current playlist. |
Remarks
Target track must be one of current playlist tracks.
The index value represents track order as they appear in the playlist (e.g. setting index to one will seek to the second playlist track and so on). Shuffle order is ignored.
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Seek(String, Int32, Single)
Advances music player to a track by index.
Declaration
public static void Seek(string playerName, int track, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.Int32 | track | Zero-based index of the track in the current playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
Target track must be one of current playlist tracks.
The index value represents track order as they appear in the playlist (e.g. setting index to one will seek to the second playlist track and so on). Shuffle order is ignored.
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Seek(String, String)
Advances music player to a track with a matching name.
Declaration
public static void Seek(string playerName, string track)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.String | track | Name of the track in the current playlist. |
Remarks
Target track must be one of current playlist tracks.
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Seek(String, String, Single)
Advances music player to a track with a matching name.
Declaration
public static void Seek(string playerName, string track, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.String | track | Name of the track in the current playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
Target track must be one of current playlist tracks.
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
SetPlaylist(ID, ID)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(ID playerID, ID playlistID)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| ID | playlistID | ID referring to the playlist. |
Remarks
If music player was playing another track it'll automatically crossfade to first track of the new playlist.
SetPlaylist(ID, ID, Single)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(ID playerID, ID playlistID, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| ID | playlistID | ID referring to the playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If music player was playing another track it'll automatically crossfade to first track of the new playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
SetPlaylist(ID, String)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(ID playerID, string playlistName)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.String | playlistName | Name of the playlist. |
Remarks
If multiple banks have playlists with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found playlist will be used.
If music player was playing another track it'll automatically crossfade to first track of the new playlist.
SetPlaylist(ID, String, Single)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(ID playerID, string playlistName, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.String | playlistName | Name of the playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have playlists with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found playlist will be used.
If music player was playing another track it'll automatically crossfade to first track of the new playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
SetPlaylist(String, ID)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(string playerName, ID playlistID)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| ID | playlistID | ID referring to the playlist. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
If music player was playing another track it'll automatically crossfade to first track of the new playlist.
SetPlaylist(String, ID, Single)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(string playerName, ID playlistID, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| ID | playlistID | ID referring to the playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
If music player was playing another track it'll automatically crossfade to first track of the new playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
SetPlaylist(String, String)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(string playerName, string playlistName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.String | playlistName | Name of the playlist. |
Remarks
If multiple banks have music players/playlists with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player/playlist will be used.
If music player was playing another track it'll automatically crossfade to the first track of the new playlist.
SetPlaylist(String, String, Single)
Sets a playlist to a music player.
Declaration
public static void SetPlaylist(string playerName, string playlistName, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.String | playlistName | Name of the playlist. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have music players/playlists with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player/playlist will be used.
If music player was playing another track it'll automatically crossfade to first track of the new playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Stop(ID)
Stops music player.
Declaration
public static void Stop(ID playerID)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Stop(ID, Single)
Stops music player.
Declaration
public static void Stop(ID playerID, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| ID | playerID | ID referring to the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Stop(String)
Stops music player.
Declaration
public static void Stop(string playerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Stop(String, Single)
Stops music player.
Declaration
public static void Stop(string playerName, float fade)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | playerName | Name of the music player. |
| System.Single | fade | Crossfade duration in seconds. |
Remarks
If multiple banks have music players with a matching name, the primary music bank will be checked first. Within a bank, the first occurrence of found music player will be used.
This method does nothing if no playlist was assigned to the music player. Use SetPlaylist(String, String) or SetPlaylist(String, String, Single) to assign a playlist.
Crossfade parameter value will override MusicPlayer.Fade value.
Events
| Improve this Doc View SourceOnPlaybackPaused
The delegate informing about playback pause in any of the music players.
Declaration
public static event PlaybackChangedDelegate OnPlaybackPaused
Event Type
| Type | Description |
|---|---|
| PlaybackChangedDelegate |
Remarks
This delegate will only be called after the music player fades out.
OnPlaybackStarted
The delegate informing about playback start in any of the music players.
Declaration
public static event PlaybackChangedDelegate OnPlaybackStarted
Event Type
| Type | Description |
|---|---|
| PlaybackChangedDelegate |
OnPlaybackStopped
The delegate informing about playback stop in any of the music players.
Declaration
public static event PlaybackChangedDelegate OnPlaybackStopped
Event Type
| Type | Description |
|---|---|
| PlaybackChangedDelegate |
Remarks
This delegate will only be called after the music player fades out.
OnTrackChanged
The delegate informing about tracks changes in any of the music players.
Declaration
public static event TrackChangedDelegate OnTrackChanged
Event Type
| Type | Description |
|---|---|
| TrackChangedDelegate |