Struct sfml::audio::SoundBuffer
[−]
[src]
pub struct SoundBuffer { // some fields omitted }
Storage of audio sample
A sound buffer holds the data of a sound, which is an array of audio samples.
Methods
impl SoundBuffer
[src]
fn new(filename: &str) -> Option<SoundBuffer>
Create a new sound buffer and load it from a file
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
Arguments
- filename - Path of the sound file to load
Return an option to a SoundBuffer object or None.
fn save_to_file(&self, filename: &str) -> bool
Save a sound buffer to an audio file
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
Arguments
- filename - Path of the sound file to write
Return true if saving succeeded, false if it faileds
fn get_sample_count(&self) -> i64
Get the number of samples stored in a sound buffer
The array of samples can be accessed with the get_samples function.
Return the number of samples
fn get_channel_count(&self) -> u32
Get the number of channels used by a sound buffer
If the sound is mono then the number of channels will be 1, 2 for stereo, etc.
Return the number of channels
fn get_duration(&self) -> Time
Get the total duration of a sound buffer
Return the sound duration
fn get_sample_rate(&self) -> u32
Get the sample rate of a sound buffer
The sample rate is the number of samples played per second. The higher, the better the quality (for example, 44100 samples/s is CD quality).
Return the sample rate (number of samples per second)
Trait Implementations
impl Clone for SoundBuffer
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Drop for SoundBuffer
[src]
fn drop(&mut self)
Destructor for class SoundBuffer. Destroy all the ressource.