Music

Music represents the functionality to load and play music files. * Note: Music is designed to load and play <b>larger</b> music files, e.g. background music If you just want to play short sounds, use Sound. * Supported formats are .wav, .mp3, .vorbis, .ogg, .midi *

Constructors

this
this(string filename, ubyte volume = 128)

CTor

Destructor

~this
~this()

DTor

Postblit

this(this)
@disable this(this)

Postblit is disabled

Copying this object is disabled.

Members

Functions

fadeOut
void fadeOut(ushort ms)

Fade out the music. The music will be stopped in ms milliseconds.

getVolume
ubyte getVolume()

Returns the current volume

isPaused
bool isPaused()

Returns if the music is currently paused

isPlaying
bool isPlaying()

Returns if the music is currently playing

loadFromFile
bool loadFromFile(string filename)

Load the music file (filename). Returns if the loading was successful. If not, an error message is showed which describes what the problem is.

pause
void pause()

Pause the music playback

play
void play(byte loops = 1, short delay = -1)

Plays the music. loops describe how often the music shall be played. A value of -1 indicated, that the music plays forever, a value of 0 means, that the music plays zero times. delay is the time in ms to fade in. Any previous music will be halted.

resume
void resume()

Resume the music playback

rewind
void rewind()

Rewind the music to the start

setPosition
void setPosition(float seconds)

Set the position of the currently playing music. The position takes different meanings for different music sources.

setVolume
ubyte setVolume(ubyte volume)

Set the volume, max. is 128, min. is 0 If the value is above 128, the max. will be assumed. Returns the previous volume.

stop
void stop()

Stop/Halt the music playback

Meta

Authors

Randy Schuett (rswhite4@googlemail.com)