Dgame.Audio.Music
« Go back
Bottom- struct Music;
- Music represents the functionality to load and play music files.
Note:
Music is designed to load and play larger music files, e.g. background music If you just want to play short sounds, use Sound.
Supported formats are .wav, .mp3, .vorbis, .ogg, .midi
Author:
Randy Schuett (rswhite4@googlemail.com)
- nothrow @nogc this(string filename, ubyte volume = 128);
- CTor
- nothrow @nogc 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.
- const nothrow @nogc 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.
- const nothrow @nogc ubyte getVolume();
- Returns the current volume
- nothrow @nogc 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.
- const nothrow @nogc void resume();
- Resume the music playback
See:
pause
See:
stop
- const nothrow @nogc void stop();
- Stop/Halt the music playback
See:
resume
- const nothrow @nogc void pause();
- Pause the music playback
See:
resume
- const nothrow @nogc void rewind();
- Rewind the music to the start
Note:
This function only works for .ogg, .vorbis, .mp3, .midi
- nothrow @nogc void fadeOut(ushort ms);
- Fade out the music. The music will be stopped in ms milliseconds.
- const nothrow @nogc void setPosition(float seconds);
- Set the position of the currently playing music.
The position takes different meanings for different music sources.
.ogg / .vorbis: Jumps to position seconds from the beginning of the song. mp3: Jumps to position seconds from the current position in the stream. So you may want to call rewind before. Does not go in reverse: negative values do nothing.
Note:
This only works for.ogg, .vorbis and .mp3
- const nothrow @nogc bool isPlaying();
- Returns if the music is currently playing
- const nothrow @nogc bool isPaused();
- Returns if the music is currently paused
Page generated by Ddoc.
« Go back