dsfml.audio.sound



class Sound;
Sound defines the properties of the sound such as position, volume, pitch, etc.

this();
Default constructor

this(SoundBuffer buffer, bool loop = false, float pitch = 1F, float volume = 100F, float x = 0F, float y = 0F, float z = 0F);
Construct the sound from its parameters

Params:
SoundBuffer buffer Sound buffer to play
bool loop Loop flag (false by default)
float pitch Value of the pitch (1 by default)
float volume Volume (100 by default)
float x X position (0 by default)
float y Y position (0 by default)
float z Z position (0 by default)

void play();
Play the sound

void pause();
Pause the sound

void stop();
Stop the sound

void setBuffer(SoundBuffer buffer);
Set the source buffer

Params:
SoundBuffer buffer New sound buffer to bind to the sound

void setLoop(bool loop);
Set the sound loop state. This parameter is disabled by default

Params:
bool loop True to play in loop, false to play once

void setPitch(float pitch);
Set the sound pitch. The default pitch is 1

Params:
float pitch New pitch

void setVolume(float volume);
Set the sound volume. The default volume is 100

Params:
float volume Volume (in range [0, 100])

void setPosition(float x, float y, float z);
Set the sound position. The default position is (0, 0, 0)

Params:
float x X position of the sound in the world
float y Y position of the sound in the world
float z Z position of the sound in the world

void setPosition(Vector3!(float) position);
Set the sound position. The default position is (0, 0, 0)

Params : position = new position

void setMinDistance(float minDistance);
Set the minimum distance - closer than this distance the listener will hear the sound at its maximum volume. The default distance is 1.0

Params:
float minDistance new minimum distance for the sound

void setAttenuation(float attenuation);
Set the attenuation factor - the higher the attenuation, the more the sound will be attenuated with distance from listener. The default attenuation factor 1.0

Params:
float attenuation new attenuation factor for the sound

SoundBuffer getBuffer();
Get the source buffer

Returns:
Sound buffer bound to the sound (can be NULL)

bool getLoop();
Tell whether or not the sound is looping

Returns:
True if the sound is looping, false otherwise

float getPitch();
Get the pitch

Returns:
Pitch value

float getVolume();
Get the volume

Returns:
Volume value (in range [1, 100])

Vector3!(float) getPosition();
Get the sound position

Params:
x X position of the sound in the world
y Y position of the sound in the world
z Z position of the sound in the world

float getMinDistance();
Get the minimum distance

Returns:
Minimum distance for the sound

float getAttenuation();
Get the attenuation factor

Returns:
Attenuation factor of the sound



SoundStatus getStatus();
Get the status of the sound (stopped, paused, playing)

Returns:
Current status of the sound

float getPlayingOffset();
Get the current playing position of the sound

Returns:
Current playing position, expressed in seconds


Page generated by Ddoc.