Play the specified audio track, replacing whatever track was playing.
The clip loops, and its name becomes the current track for
stopTrack / pauseTrack / resumeTrack /
getCurrentTrack. The previous track is stopped first, so only one
track is ever playing: there is a single current-track slot, and a track
left running after the slot had moved on could no longer be reached by any
of those four.
Calling it with the name already playing restarts that track from the
beginning, the same as play on any other clip. Scene code that
wants the bed to carry on across a screen change should not call this
again, rather than rely on it doing nothing.
Use play for sound effects: they are meant to overlap, and nothing
here applies to them.
Parameters
sound_name: string
Audio track name (case-sensitive).
Optionalvolume: number
Playback volume, 0.0..1.0. Defaults to the current
global volume.
Returns number
The sound instance ID.
Throws
when no clip of that name is loaded, raised before anything
is stopped, so a mistyped name cannot silence the music already playing.
Example
me.audio.playTrack("menu_theme"); me.audio.playTrack("battle_theme"); // the menu theme stops
Play the specified audio track, replacing whatever track was playing.
The clip loops, and its name becomes the current track for stopTrack / pauseTrack / resumeTrack / getCurrentTrack. The previous track is stopped first, so only one track is ever playing: there is a single current-track slot, and a track left running after the slot had moved on could no longer be reached by any of those four.
Calling it with the name already playing restarts that track from the beginning, the same as play on any other clip. Scene code that wants the bed to carry on across a screen change should not call this again, rather than rely on it doing nothing.
Use play for sound effects: they are meant to overlap, and nothing here applies to them.