Sound

Sound represents the functionality to load and play sound files.

Note: Sound is designed to load and play <b>short</b> 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 *

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

expire
void expire(ushort ms)

Stop sound playback after ms milliseconds.

getChannel
ushort getChannel()

Returns the current channel in which this Sound plays. Should be in range of 1 .. 256

getVolume
ubyte getVolume()

Returns the current volume.

isPaused
bool isPaused()

Returns if the sound is currently paused

isPlaying
bool isPlaying()

Returns if the sound is currently playing

loadFromFile
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.

pause
void pause()

Pause the sound playback

play
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.

resume
void resume()

Resume the sound playback

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 sound playback

Meta

Authors

Randy Schuett (rswhite4@googlemail.com)