yage.resource.sound
Authors:
Eric Poggel
License:
LGPL v3
- class
Sound
;
- A
Sound
is a represenation of sound data in system memory.
Sounds use a SoundFile as a member variable, which abstracts away the differences between different sound formats.
During initialization, a
Sound
loads the sound data from a file and
passes it on to OpenAL for playback, as it's needed.
- this(char[] filename);
void
dispose
();
- Load a sound from a file.
Note that the file is not closed until the destructor is called.
Params:
source |
Filename of the sound to load. |
- uint
getFrequency
();
- Get the frequency of the sound (often 22050 or 44100)
- uint[]
getBuffers
();
- Get a pointer to the array of OpenAL buffer id's used for this sound.
allocBuffers() and freeBuffers() are used to assign and release buffers from the sound source.
- uint
getBuffersLength
();
- Get the number of buffers this sound was divided into
- uint
getBuffersPerSecond
();
- Get the number of buffers created for each second of this sound
- double
getLength
();
- Get the length of the sound in seconds
- uint
getSize
();
- Return the size of the uncompressed sound data, in bytes.
- char[]
getSource
();
- Get the filename this Sound was loaded from.
- uint[]
getBuffers
(int first, int last);
- TODO:
convert last to be number, to be consistent with alloBuffers and FreeBuffers?
- void
allocBuffers
(int first, int number);
- Create openAL buffers in the buffers array for the given range.
As sounds request buffers, a reference counters are incremented/decremented for each buffer,
and the openAL buffers are destroyed when the reference counter reaches zero.
This can accept buffers outside of the range of buffers and will wrap them around to support easy looping.
- void
freeBuffers
(int first, int number);
- Mark the range of buffers for freeing.
This will decrement the reference count for each of the buffers
and will release it once it's at zero.
- char[]
toString
();
- Print useful information about the loaded sound file.
|