25 #ifndef SFML_SOUNDSTREAM_HPP
26 #define SFML_SOUNDSTREAM_HPP
31 #include <SFML/Audio/Export.hpp>
32 #include <SFML/Audio/SoundSource.hpp>
33 #include <SFML/System/Thread.hpp>
34 #include <SFML/System/Time.hpp>
35 #include <SFML/System/Mutex.hpp>
210 void initialize(
unsigned int channelCount,
unsigned int sampleRate);
279 bool fillAndPushBuffer(
unsigned int bufferNum,
bool immediateLoop =
false);
310 mutable Mutex m_threadMutex;
311 Status m_threadStartState;
313 unsigned int m_buffers[BufferCount];
314 unsigned int m_channelCount;
315 unsigned int m_sampleRate;
318 Uint64 m_samplesProcessed;
319 Int64 m_bufferSeeks[BufferCount];
325 #endif // SFML_SOUNDSTREAM_HPP
Structure defining a chunk of audio data to stream.
virtual bool onGetData(Chunk &data)=0
Request a new chunk of audio samples from the stream source.
Abstract base class for streamed audio sources.
unsigned int getSampleRate() const
Get the stream sample rate of the stream.
void setLoop(bool loop)
Set whether or not the stream should loop after reaching the end.
virtual Int64 onLoop()
Change the current playing position in the stream source to the beginning of the loop.
void pause()
Pause the audio stream.
unsigned int getChannelCount() const
Return the number of channels of the stream.
bool getLoop() const
Tell whether or not the stream is in loop mode.
virtual void onSeek(Time timeOffset)=0
Change the current playing position in the stream source.
const Int16 * samples
Pointer to the audio samples.
Base class defining a sound's properties.
Time getPlayingOffset() const
Get the current playing position of the stream.
std::size_t sampleCount
Number of samples pointed by Samples.
void stop()
Stop playing the audio stream.
SoundStream()
Default constructor.
void setPlayingOffset(Time timeOffset)
Change the current playing position of the stream.
Status getStatus() const
Get the current status of the stream (stopped, paused, playing)
Blocks concurrent access to shared resources from multiple threads.
Utility class to manipulate threads.
Status
Enumeration of the sound source states.
void initialize(unsigned int channelCount, unsigned int sampleRate)
Define the audio stream parameters.
void play()
Start or resume playing the audio stream.
virtual ~SoundStream()
Destructor.