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;
284 #endif // SFML_SOUNDBUFFER_HPP
bool loadFromFile(const std::string &filename)
Load the sound buffer from a file.
Uint64 getSampleCount() const
Get the number of samples stored in the buffer.
Regular sound that can be played in the audio environment.
Time getDuration() const
Get the total duration of the sound.
const Int16 * getSamples() const
Get the array of audio samples stored in the buffer.
SoundBuffer(const SoundBuffer ©)
Copy constructor.
Storage for audio samples defining a sound.
unsigned int getChannelCount() const
Get the number of channels used by the sound.
bool loadFromMemory(const void *data, std::size_t sizeInBytes)
Load the sound buffer from a file in memory.
~SoundBuffer()
Destructor.
bool loadFromStream(InputStream &stream)
Load the sound buffer from a custom stream.
bool saveToFile(const std::string &filename) const
Save the sound buffer to an audio file.
SoundBuffer()
Default constructor.
Base class for classes that require an OpenAL context.
bool loadFromSamples(const Int16 *samples, Uint64 sampleCount, unsigned int channelCount, unsigned int sampleRate)
Load the sound buffer from an array of audio samples.
unsigned int getSampleRate() const
Get the sample rate of the sound.