bn::music namespace
#include <bn_music.h>

Direct Sound music related functions.

Functions

auto playing() -> bool
Indicates if currently there's any Direct Sound music playing or not.
auto playing_item() -> optional<music_item>
Returns the active music_item if there's any Direct Sound music playing; bn::nullopt otherwise.
void play(music_item item)
Plays the Direct Sound music specified by the given music_item with default settings.
void play(music_item item, fixed volume)
Plays the Direct Sound music specified by the given music_item.
void play(music_item item, fixed volume, bool loop)
Plays the Direct Sound music specified by the given music_item.
void stop()
Stops playback of the active Direct Sound music.
auto paused() -> bool
Indicates if the active Direct Sound music has been paused or not.
void pause()
Pauses playback of the active Direct Sound music.
void resume()
Resumes playback of the paused Direct Sound music.
auto position() -> int
Returns the sequence position of the active Direct Sound music.
void set_position(int position)
Sets the sequence position of the active Direct Sound music.
auto volume() -> fixed
Returns the volume of the active Direct Sound music.
void set_volume(fixed volume)
Sets the volume of the active Direct Sound music.
auto tempo() -> fixed
Returns the tempo of the active Direct Sound music.
void set_tempo(fixed tempo)
Sets the tempo of the active Direct Sound music.
auto pitch() -> fixed
Returns the pitch of the active Direct Sound music.
void set_pitch(fixed pitch)
Sets the pitch of the active Direct Sound music.

Function documentation

void bn::music::play(music_item item)

Plays the Direct Sound music specified by the given music_item with default settings.

Default settings are volume = 1 and loop enabled.

void bn::music::play(music_item item, fixed volume)

Plays the Direct Sound music specified by the given music_item.

Parameters
item Specifies the music to play.
volume Volume level, in the range [0..1].

void bn::music::play(music_item item, fixed volume, bool loop)

Plays the Direct Sound music specified by the given music_item.

Parameters
item Specifies the music to play.
volume Volume level, in the range [0..1].
loop Indicates if it must be played until it is stopped manually or until end.

void bn::music::set_volume(fixed volume)

Sets the volume of the active Direct Sound music.

Parameters
volume Volume level, in the range [0..1].

void bn::music::set_tempo(fixed tempo)

Sets the tempo of the active Direct Sound music.

Parameters
tempo Tempo level, in the range [0.5..2].

void bn::music::set_pitch(fixed pitch)

Sets the pitch of the active Direct Sound music.

Parameters
pitch Pitch level, in the range [0.5..2].