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_StatusGetVolume
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 );
Name | Type | Description |
flVolume | float | The 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
Name | Type | Description |
m_flNewVolume | float | |
Enums
These are enums which are defined for use with ISteamMusic.
AudioPlayback_Status
Specifies the current playback status.
Name | Value | Description |
AudioPlayback_Undefined | 0 | The Steam music interface probably isn't enabled. |
AudioPlayback_Playing | 1 | Steam Music is currently playing. |
AudioPlayback_Paused | 2 | Steam Music is currently paused. |
AudioPlayback_Idle | 3 | Steam Music is currently stopped. |
Constants
These are constants which are defined for use with ISteamMusic.
Name | Type | Value | Description |
STEAMMUSIC_INTERFACE_VERSION | const char * | "STEAMMUSIC_INTERFACE_VERSION001" | |