Class MusicPlayer
The persistent storage for playback rules of a particular playlist.
Inheritance
Namespace: Stem
Assembly: Stem.dll
Syntax
[Serializable]
public class MusicPlayer : ISerializationCallbackReceiver
Properties
| Improve this Doc View SourceAudible
The flag indicating if the music player can be heard.
Declaration
public bool Audible { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the music player can be heard. False otherwise. |
Bank
The music bank the music player belongs to.
Declaration
public MusicBank Bank { get; set; }
Property Value
Type | Description |
---|---|
MusicBank | A reference to a music bank. |
Fade
The crossfade parameter that is used when the music player transitions between tracks or playback states.
Declaration
public float Fade { get; set; }
Property Value
Type | Description |
---|---|
System.Single | Crossfade duration in seconds. |
ID
The unique identifier for fast access to the music player.
Declaration
public int ID { get; }
Property Value
Type | Description |
---|---|
System.Int32 | A unique identifier value of the music player. |
Loop
The flag indicating whether the music player should repeat playlist tracks after they finish.
Declaration
public bool Loop { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the music player is looping playlist tracks. False otherwise. |
Remarks
If PlaybackMode value is AutoAdvance then this flag is indicating whether the music player should repeat the whole playlist instead of individual playlist track.
MixerGroup
The reference to an audio mixer group. Please refer to Unity Scripting Reference for details.
Declaration
public AudioMixerGroup MixerGroup { get; set; }
Property Value
Type | Description |
---|---|
AudioMixerGroup | A reference to a mixer group. |
Muted
The flag indicating if the music player is muted and can't be heard.
Declaration
public bool Muted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the music player is muted. False otherwise. |
Remarks
This flag may be overridden by the Soloed flag, i.e. if the music player is simultaneously muted and soloed it'll be audible.
Name
The name of the music player. Used for fast search in corresponding music bank.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | Name of the music player. |
PlaybackMode
The playback mode defining how music player should play its tracks.
Declaration
public MusicPlayerPlaybackMode PlaybackMode { get; set; }
Property Value
Type | Description |
---|---|
MusicPlayerPlaybackMode | An enum value. |
Playlist
The reference to a playlist which will be played.
Declaration
public Playlist Playlist { get; set; }
Property Value
Type | Description |
---|---|
Playlist | A reference to a playlist. |
PlayOnStart
The flag indicating whether the music player should start playing once the game started.
Declaration
public bool PlayOnStart { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the music player should play on start. False otherwise. |
Shuffle
The flag indicating whether the music player should play tracks in random order.
Declaration
public bool Shuffle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the music player is playing playlist tracks in random order. False if it's playing sequentially. |
Remarks
Note that tracks will be reshuffled again after the player will finish playing all the tracks.
Soloed
The flag indicating if the music player is soloed. If set to true, all other non-solo music players won't be audible.
Declaration
public bool Soloed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the music player is soloed. False otherwise. |
Remarks
This flag may override the Muted flag, i.e. if the music player is simultaneously muted and soloed it'll be audible.
SyncGroup
The sync group of the music player. Music players with the same sync group will share playback time.
Declaration
public byte SyncGroup { get; set; }
Property Value
Type | Description |
---|---|
System.Byte | Sync group of the music player. |
Remarks
Sync groups work only if PlaybackMode value is Synced.
Unfolded
The flag indicating whether the music bank inspector should show advanced settings for the music player.
Declaration
public bool Unfolded { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if advanced settings are shown. False otherwise. |
Remarks
This property is used only by the music bank inspector and does nothing during runtime.
Volume
The volume of the music player.
Declaration
public float Volume { get; set; }
Property Value
Type | Description |
---|---|
System.Single | Volume of the music player. Value must be in [0;1] range. |
Methods
| Improve this Doc View SourceOnAfterDeserialize()
Prepares sound for runtime use after deserialization.
Declaration
public void OnAfterDeserialize()
Remarks
This method is automatically called by Unity during deserialization process. Don't call it manually.
OnBeforeSerialize()
Prepares sound for serialization.
Declaration
public void OnBeforeSerialize()
Remarks
This method is automatically called by Unity during serialization process. Don't call it manually.
Events
| Improve this Doc View SourceOnPlaybackPaused
The delegate informing about playback pause in the music player.
Declaration
public 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 the music player.
Declaration
public event PlaybackChangedDelegate OnPlaybackStarted
Event Type
Type | Description |
---|---|
PlaybackChangedDelegate |
OnPlaybackStopped
The delegate informing about playback stop in the music player.
Declaration
public 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 the music player.
Declaration
public event TrackChangedDelegate OnTrackChanged
Event Type
Type | Description |
---|---|
TrackChangedDelegate |