Music

Thin wrap around Mix_Music including loading [FLAC, MikMod, Ogg Vorbis, MP3, Wav] using SDL_Mixer.

Constructors

this
this(string path)

Loads a music file

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

dispose
void dispose()

Deallocates the memory and invalidates this.

fadeIn
bool fadeIn(int ms, int loops = 1)

Starts this music by fading in over ms milliseconds, will stop other musics. -1 loops will play forever.

fadeIn
bool fadeIn(int ms, int loops, double position)

Starts this music by fading in over ms milliseconds, will stop other musics.

play
bool play(int loops = 1)

Plays this music, will stop other musics. -1 loops will play forever.

Properties

error
string error [@property getter]

Returns the latest sound related error

fadingStatus
FadingStatus fadingStatus [@property getter]
handle
Mix_Music* handle [@property getter]

Handle to the Mix_Music*.

isPaused
bool isPaused [@property getter]
isPlaying
bool isPlaying [@property getter]
position
double position [@property setter]

Modifies the position where currently playing.

type
MusicType type [@property getter]
valid
bool valid [@property getter]

Checks if the handle is not null.

volume
float volume [@property getter]

Returns the current volume as float in range 0.0 to 1.0

volume
float volume [@property setter]

Sets the current volume as float in range 0.0 to 1.0

Static functions

fromMusic
Music fromMusic(Mix_Music* handle)

Creates music from a Mix_Music*.

pause
void pause()

Pause the music playback. You may halt paused music. Note: Music can only be paused if it is actively playing.

resume
void resume()

Unpause the music. This is safe to use on halted, paused, and already playing music.

rewind
void rewind()

Rewinds music to the start. This is safe to use on halted, paused, and already playing music. It is not useful to rewind the music immediately after starting playback, because it starts at the beginning by default.

stop
void stop()

Halt playback of music. This interrupts music fader effects.

Meta