Steamworks Documentation
ISteamMusic Interface
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 start playing afterwards.

See features/music_player for more information.

Member Functions

Member functions for ISteamMusic are called through the global accessor function SteamMusic().

BIsEnabled

bool BIsEnabled();
Checks if Steam Music is enabled.

Returns: bool
true if it is enabled; otherwise false.

BIsPlaying

bool BIsPlaying();
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
true if a song is currently playing, paused, or queued up to play; otherwise false.

GetPlaybackStatus

AudioPlayback_Status GetPlaybackStatus();
Gets the current status of the Steam Music player.

Returns: AudioPlayback_Status

GetVolume

float GetVolume();
Gets the current volume of the Steam Music player.

Returns: float
The volume is returned as a percentage between 0.0 and 1.0.

Pause

void Pause();
Pause the Steam Music player.

Play

void Play();
Have the Steam Music player resume playing.

PlayNext

void PlayNext();
Have the Steam Music player skip to the next song.

PlayPrevious

void PlayPrevious();
Have the Steam Music player play the previous song.

SetVolume

void SetVolume( float flVolume );
NameTypeDescription
flVolumefloatThe volume percentage to set from 0.0 to 1.0.

Sets the volume of the Steam Music player.

Callbacks

These are callbacks which can be fired by calling SteamAPI_RunCallbacks. Many of these will be fired directly in response to the member functions of ISteamMusic.

PlaybackStatusHasChanged_t


This callback has no fields.

VolumeHasChanged_t



NameTypeDescription
m_flNewVolumefloat

Enums

These are enums which are defined for use with ISteamMusic.

AudioPlayback_Status

Specifies the current playback status.

NameValueDescription
AudioPlayback_Undefined0The Steam music interface probably isn't enabled.
AudioPlayback_Playing1Steam Music is currently playing.
AudioPlayback_Paused2Steam Music is currently paused.
AudioPlayback_Idle3Steam Music is currently stopped.

Constants

These are constants which are defined for use with ISteamMusic.

NameTypeValueDescription
STEAMMUSIC_INTERFACE_VERSIONconst char *"STEAMMUSIC_INTERFACE_VERSION001"