dsfml.audio.soundbuffer



class SoundBuffer;
SoundBuffer is the low-level for loading and manipulating sound buffers

this();
Default constructor

bool loadFromFile(char[] filename);
Load the sound buffer from a file

Params:
char[] filename Path of the sound file to load

Returns:
True if loading has been successful

bool loadFromMemory(byte[] data);
Load the sound buffer from a file in memory

Params:
byte[] data Array of file data in memory

Returns:
True if loading has been successful

bool loadFromSamples(short[] samples, uint channelsCount, uint sampleRate);
Load the sound buffer from an array of samples - assumed format for samples is 16 bits signed integer

Params:
short[] samples Array of samples in memory
uint channelsCount Number of channels (1 = mono, 2 = stereo, ...)
uint sampleRate Frequency (number of samples to play per second)

Returns:
True if loading has been successful

bool saveToFile(char[] filename);
Save the sound buffer to a file

Params:
char[] filename Path of the sound file to write

Returns:
True if saving has been successful

short[] getSamples();
Return the sound samples

Returns:
Array of sound samples, in 16 bits signed integer format

uint getSamplesCount();
Return the samples count

Returns:
Number of samples

uint getSampleRate();
Get the sample rate

Returns:
Sound frequency (number of samples per second)

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

Returns:
Number of channels

float getDuration();
Get the sound duration

Returns:
Sound duration, in seconds


Page generated by Ddoc.