Dgame.Audio.Sound

« Go back

Bottom


struct Sound;
Sound represents the functionality to load and play sound files.

Note:
Sound is designed to load and play short music files, e.g. sounds for some noises. If you want to play larger music, use Music.

Note:
Each Sound is played in his own channel, which means, that the number of simultaneously existing Sounds is limited to 256. This limit will be increased if necessary.

Supported formats are .wav, .mp3, .vorbis, .ogg, .midi

Author:
Randy Schuett (rswhite4@googlemail.com)

nothrow @nogc this(string filename, ubyte volume = 128);
CTor

const pure nothrow @nogc ushort getChannel();
Returns the current channel in which this Sound plays. Should be in range of 1 .. 256

nothrow @nogc bool loadFromFile(string filename);
Load the sound file (filename). Returns if the loading was successful. If not, an error message is showed which describes what the problem is.

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.

nothrow @nogc ubyte getVolume();
Returns the current volume.

nothrow @nogc bool play(byte loops = 1, short delay = -1);
Plays the sound. loops describe how often the sound shall be played. A value of -1 indicated, that the sound plays forever, a value of 0 means, that the sound plays zero times. delay is the time in ms to fade in. Any previous sound will be halted.

const nothrow @nogc void resume();
Resume the sound playback

See:
pause

See:
stop

const nothrow @nogc void stop();
Stop/Halt the sound playback

See:
resume

const nothrow @nogc void pause();
Pause the sound playback

See:
resume

const nothrow @nogc void expire(ushort ms);
Stop sound playback after ms milliseconds.

const nothrow @nogc bool isPlaying();
Returns if the sound is currently playing

const nothrow @nogc bool isPaused();
Returns if the sound is currently paused


Page generated by Ddoc.

» Dgame.Audio.Sound on Github

Top

« Go back