Sound

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

Constructors

this
this(string path)

Loads a sound 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
int fadeIn(int ms, int loops = 1, int channel = -1, int maxTicks = -1)

Plays this sound in the selected channel with a fade in effect.

play
int play(int loops = 0, int channel = -1, int maxTicks = -1)

Plays this sound in the selected channel.

Properties

error
string error [@property getter]

Returns the latest sound related error

fadingStatus
int fadingStatus [@property setter]
handle
Mix_Chunk* handle [@property getter]

Handle to the Mix_Chunk*.

isPaused
int isPaused [@property setter]

Tells you how many channels are paused if set to -1

isPlaying
int isPlaying [@property setter]

Tells you how many channels are playing if set to -1

valid
bool valid [@property getter]

Checks if the handle is not null.

Static functions

fromChunk
Sound fromChunk(Mix_Chunk* chunk)

Creates sound from a Mix_Chunk*.

getVolume
float getVolume(int channel = -1)

Returns the current volume as float in range 0.0 to 1.0

pause
void pause(int channel = -1)

Pause the sound playback. You may halt paused sounds.

resume
void resume(int channel = -1)

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

setVolume
void setVolume(float value, int channel = -1)

Sets the current volume as float in range 0.0 to 1.0

stop
void stop(int channel = -1)

Halt playback of sound. This interrupts sound fader effects.

Meta