Music
Functions to control music playback in the Steam client. This gives games the opportunity to do things like pause the music or lower the volume when an important cut scene is shown, and then start playing again afterwards. These functions only work with soundtracks you purchased or own on Steam.
Only available in the main GodotSteam branches
Functions
getPlaybackStatus
getPlaybackStatus( )
Gets the current status of the Steam Music player.
Returns: AudioPlaybackStatus enum
musicIsEnabled
musicIsEnabled( )
Checks if Steam Music is enabled.
Returns: bool
Returns true if it is enabled; otherwise, false.
musicIsPlaying
musicIsPlaying( )
Checks if Steam Music is active. This does not necessarily a song is currently playing, it may be paused.
For finer grain control use getPlaybackStatus.
Returns: bool
Returns true if a song is currently playing, paused, or queued up to play; otherwise, false.
musicGetVolume
musicGetVolume( )
Gets the current volume of the Steam Music player.
Returns: float
The volume is returned as a percentage between 0.0 and 1.0.
musicPause
musicPause( )
Pause the Steam Music player.
Returns: void
musicPlay
musicPlay( )
Have the Steam Music player resume playing.
Returns: void
musicPlayNext
musicPlayNext( )
Have the Steam Music player skip to the next song.
Returns: void
musicPlayPrev
musicPlayPrev( )
Have the Steam Music player play the previous song.
Returns: void
musicSetVolume
musicSetVolume( float
value )
Parameter | Type | Notes |
---|---|---|
value | float | The volume percentage to set from 0.0 to 1.0. |
Sets the volume of the Steam Music player.
Returns: void
Signals
These callbacks require you to setup one of the three callback methods to receive them.
music_playback_status_has_changed
music_playback_status_has_changed
No notes about this in the Steam docs, but we can assume it just updates us about the playback status.
Returns
Nothing.
music_volume_has_changed
music_volume_has_changed
No notes about this in the Steam docs, but we can assume it just updates us about the volume changes.
Returns
Key | Type | Notes |
---|---|---|
new_volume | float | - |
Enums
AudioPlaybackStatus
Enumerator | SDK Name | Value | Notes |
---|---|---|---|
AUDIO_PLAYBACK_UNDEFINED | AudioPlayback_Undefined | 0 | The Steam music interface probably isn't enabled. |
AUDIO_PLAYBACK_PLAYING | AudioPlayback_Playing | 1 | Steam Music is currently playing. |
AUDIO_PLAYBACK_PAUSED | AudioPlayback_Paused | 2 | Steam Music is currently paused. |
AUDIO_PLAYBACK_IDLE | AudioPlayback_Idle | 3 | Steam Music is currently stopped. |