🟧
Sounds Good Documentation
English
English
  • Welcome!
  • FIRSTS STEPS
    • Create your first sound
  • Create and use audio outputs
  • Included Prefabs
  • Update from 1.0 to 2.0
  • DOCUMENTATION
    • Assemblies and Namespaces
    • Prefixes
    • Audio objects
      • Sound
        • Properties
        • Methods
      • Music
        • Properties
        • Methods
      • Playlist
        • Properties
        • Methods
      • DynamicMusic
        • Properties
        • Methods
    • Editor windows
      • Audio Creator
      • Audio Collection
      • Output Manager
    • SoundsGoodManager
  • Extras
    • Credits
    • Acknowledgments
Powered by GitBook
On this page
  • 📌 Summary Table
  • 📘 Detailed Description
  1. DOCUMENTATION
  2. Audio objects
  3. Playlist

Methods

📌 Summary Table

Method
Type
Brief description

Playlist()

Playlist

Creates an empty playlist.

Playlist(Track[] playlistTracks)

Playlist

Creates a playlist from an array of Track in the given order.

Playlist(string[] playlistTags)

Playlist

Creates a playlist from an array of tags in the given order.

SetVolume(float volume)

Playlist

Sets the initial volume of the playlist (0–1).

SetHearDistance(float minHearDistance, float maxHearDistance)

Playlist

Defines the minimum and maximum hearing distances.

SetVolumeRolloffCurve(VolumeRolloffCurve curve)

Playlist

Selects the attenuation curve (logarithmic or linear).

SetCustomVolumeRolloffCurve(AnimationCurve customCurve)

Playlist

Applies a custom attenuation curve.

ChangeVolume(float newVolume, float lerpTime)

void

Changes volume during playback (smooth if lerpTime > 0).

SetPitch(float pitch)

Playlist

Sets a fixed pitch for all tracks.

SetDopplerLevel(float dopplerLevel)

Playlist

Adjusts the Doppler effect intensity (0–5).

SetId(string id)

Playlist

Assigns a unique identifier to the playlist.

SetLoop(bool loop)

Playlist

Enables (true) or disables (false) infinite looping.

SetPlaylist(Track[] playlistTracks)

Playlist

Replaces the playlist with the provided Track array.

SetPlaylist(string[] playlistTags)

Playlist

Replaces the playlist with the provided tags array.

AddToPlaylist(Track addedTrack)

void

Adds a Track to the end of the playlist at runtime.

AddToPlaylist(string addedTrackTag)

void

Adds a tag to the end of the playlist at runtime.

Shuffle()

void

Shuffles the current tracks and updates playback order.

SetPosition(Vector3 position)

Playlist

Sets the 3D world position from which the audio emits.

SetFollowTarget(Transform followTarget)

Playlist

Makes the audio source follow the specified Transform.

SetSpatialSound(bool activate)

Playlist

Toggles 3D spatial audio (true) or global 2D (false).

SetFadeOut(float fadeOutTime)

Playlist

Defines the fade-out duration at the end of each track or when stopping.

SetFadeIn(float fadeInTime)

Playlist

Defines the fade-in duration at the start of each track or when starting.

SetOutput(Output output)

Playlist

Routes audio to a specific AudioMixerGroup.

OnPlay(Action onPlay)

Playlist

Callback invoked when the playlist starts.

OnComplete(Action onComplete)

Playlist

Callback invoked when the playlist ends or is manually stopped.

OnLoopCycleComplete(Action onLoopCycleComplete)

Playlist

Callback invoked at the end of each loop cycle.

OnNextTrackStart(Action onNextTrackStart)

Playlist

Callback invoked when the next track begins.

OnPause(Action onPause)

Playlist

Callback invoked when the playlist is paused.

OnPauseComplete(Action onPauseComplete)

Playlist

Callback invoked after the pause fade-out completes.

OnResume(Action onResume)

Playlist

Callback invoked when the playlist resumes after a pause.

Play()

void

Starts playback of the playlist.

Pause(float fadeOutTime)

void

Pauses the playlist with optional fade-out.

Resume(float fadeInTime)

void

Resumes the playlist with optional fade-in.

Stop(float fadeOutTime)

void

Stops the playlist with optional fade-out.


📘 Detailed Description

Playlist Playlist()

Creates an empty instance; you must add tracks before playing.


Playlist Playlist(Track[] playlistTracks)

Creates the playlist with the given Track array in the provided order.


Playlist Playlist(string[] playlistTags)

Creates the playlist using the specified tags in the provided order.


Playlist SetVolume(float volume)

Sets the initial volume of the playlist, normalized between 0 (mute) and 1 (full volume).


Playlist SetHearDistance(float minHearDistance, float maxHearDistance)

Defines the distance at which the audio is fully audible and the distance at which it begins to fade.


Playlist SetVolumeRolloffCurve(VolumeRolloffCurve curve)

Selects a logarithmic or linear attenuation curve for distance-based volume drop-off.


Playlist SetCustomVolumeRolloffCurve(AnimationCurve customCurve)

Allows you to apply a custom attenuation curve of your choice.


void ChangeVolume(float newVolume, float lerpTime)

Changes the playlist’s volume during playback; if lerpTime > 0, the change is smoothed over that duration.


Playlist SetPitch(float pitch)

Applies a fixed pitch to all tracks in the playlist.


Playlist SetDopplerLevel(float dopplerLevel)

Adjusts Doppler effect intensity (0–5).


Playlist SetId(string id)

Assigns a unique identifier to this instance for management via SoundsGoodManager without needing a direct reference.


Playlist SetLoop(bool loop)

Enables infinite looping (true) or plays through the list once (false).


Playlist SetPlaylist(Track[] playlistTracks)

Replaces the current playlist with the provided Track array.


Playlist SetPlaylist(string[] playlistTags)

Replaces the current playlist with the provided tags array.


void AddToPlaylist(Track addedTrack)

Dynamically enqueues a Track to the end of the playlist at runtime.


void AddToPlaylist(string addedTrackTag)

Dynamically enqueues a clip by tag to the end of the playlist at runtime.


void Shuffle()

Randomizes the order of the current clips and updates playback if already playing.


Playlist SetPosition(Vector3 position)

Sets the 3D position from which the playlist audio is emitted.


Playlist SetFollowTarget(Transform followTarget)

Makes the audio source follow the specified Transform each frame.


Playlist SetSpatialSound(bool activate)

Enables (true) or disables (false) spatialized 3D audio.


Playlist SetFadeOut(float fadeOutTime)

Defines the fade-out duration applied at the end of each track or when stopping the playlist.


Playlist SetFadeIn(float fadeInTime)

Defines the fade-in duration applied at the start of each track or when the playlist begins.


Playlist SetOutput(Output output)

Routes the playlist audio to a designated AudioMixerGroup channel.


Playlist OnPlay(Action onPlay)

Callback invoked when the playlist begins playback.


Playlist OnComplete(Action onComplete)

Callback invoked when the playlist ends naturally or is manually stopped.


Playlist OnLoopCycleComplete(Action onLoopCycleComplete)

Invoked at the end of each loop cycle, if looping is enabled.


Playlist OnNextTrackStart(Action onNextTrackStart)

Invoked each time the playlist advances to the next track.


Playlist OnPause(Action onPause)

Invoked immediately when the playlist is paused.


Playlist OnPauseComplete(Action onPauseComplete)

Invoked after the pause fade-out completes.


Playlist OnResume(Action onResume)

Invoked when the playlist resumes after a pause.


void Play()

Starts playback of the playlist, applying any configured fade-in.


void Pause(float fadeOutTime)

Pauses playback; if fadeOutTime is specified, fades out before pausing.


void Resume(float fadeInTime)

Resumes playback; if fadeInTime is specified, fades in over that duration.


void Stop(float fadeOutTime)

Stops playback; if fadeOutTime is specified, fades out before stopping, otherwise stops immediately.


PreviousPropertiesNextDynamicMusic

Last updated 17 days ago