25#ifndef SFML_SOUNDBUFFER_HPP
26#define SFML_SOUNDBUFFER_HPP
31#include <SFML/Audio/Export.hpp>
32#include <SFML/Audio/AlResource.hpp>
33#include <SFML/System/Time.hpp>
135 bool loadFromSamples(
const Int16* samples, Uint64 sampleCount,
unsigned int channelCount,
unsigned int sampleRate);
249 bool update(
unsigned int channelCount,
unsigned int sampleRate);
257 void attachSound(
Sound* sound)
const;
265 void detachSound(
Sound* sound)
const;
270 typedef std::set<Sound*> SoundList;
275 unsigned int m_buffer;
276 std::vector<Int16> m_samples;
278 mutable SoundList m_sounds;
Base class for classes that require an OpenAL context.
Storage for audio samples defining a sound.
SoundBuffer()
Default constructor.
unsigned int getChannelCount() const
Get the number of channels used by the sound.
Time getDuration() const
Get the total duration of the sound.
bool loadFromFile(const std::string &filename)
Load the sound buffer from a file.
unsigned int getSampleRate() const
Get the sample rate of the sound.
const Int16 * getSamples() const
Get the array of audio samples stored in the buffer.
bool loadFromSamples(const Int16 *samples, Uint64 sampleCount, unsigned int channelCount, unsigned int sampleRate)
Load the sound buffer from an array of audio samples.
bool saveToFile(const std::string &filename) const
Save the sound buffer to an audio file.
SoundBuffer(const SoundBuffer ©)
Copy constructor.
bool loadFromStream(InputStream &stream)
Load the sound buffer from a custom stream.
~SoundBuffer()
Destructor.
Uint64 getSampleCount() const
Get the number of samples stored in the buffer.
bool loadFromMemory(const void *data, std::size_t sizeInBytes)
Load the sound buffer from a file in memory.
Regular sound that can be played in the audio environment.