dsfml.audio.music



class Music;
Music defines a big sound played using streaming, so usually what we call a music :

this();
Construct the music

bool open(char[] filename);
Open a music file (doesn't play it -- call Play for that)

Params:
char[] filename Path of the file to open

Returns:
True if loading has been successful

bool openFromMemory(byte[] data);
Open a music file from memory (doesn't play it -- call Play() for that)

Params:
byte[] data Pointer to the file data in memory
sizeInBytes Size of the data to load, in bytes

Returns:
True if loading has been successful

void play();
Start playing the audio stream

void stop();
Stop playing the audio stream

void pause();
Pause the audio stream

uint getChannelsCount();
Return the number of channels (1 = mono, 2 = stereo)

Returns:
Number of channels

uint getSampleRate();
Get the stream sample rate

Returns:
Stream frequency (number of samples per second)

float getDuration();
Get the music duration

Returns:
Music duration, in seconds

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

Returns:
Current status of the sound

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

Returns:
True if the music 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

Returns:
Current position of the music.

float getMinDistance();
Get the minimum distance

Returns:
Minimum distance for the sound

float getAttenuation();
Get the attenuation factor

Returns:
Attenuation factor of the sound



void setLoop(bool loop);
Set the music 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:
Vector3!(float) position new position

void setMinDistance(float minDistance);
Set the minimum distance - closer than thsi 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

)
Page generated by Ddoc.