Fixed calling SoundStream::setPlayingOffset() unpausing a paused SoundStream (#203), guard m_isStreaming by a mutex, fixed calling SoundStream::pause() before the stream thread starts not properly pausing the stream (http://en.sfml-dev.org/forums/index.php?topic=15197.0), minor documentation fix in SoundStream. Signed-off-by: binary1248 <binary1248@hotmail.com>
This commit is contained in:
parent
1851dcb109
commit
09aae0240d
2 changed files with 82 additions and 21 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <SFML/Audio/SoundSource.hpp>
|
||||
#include <SFML/System/Thread.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <SFML/System/Mutex.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
@ -65,8 +66,8 @@ public :
|
|||
/// \brief Start or resume playing the audio stream
|
||||
///
|
||||
/// This function starts the stream if it was stopped, resumes
|
||||
/// it if it was paused, and restarts it from beginning if it
|
||||
/// was it already playing.
|
||||
/// it if it was paused, and restarts it from the beginning if
|
||||
/// it was already playing.
|
||||
/// This function uses its own thread so that it doesn't block
|
||||
/// the rest of the program while the stream is played.
|
||||
///
|
||||
|
@ -282,6 +283,8 @@ private :
|
|||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Thread m_thread; ///< Thread running the background tasks
|
||||
mutable Mutex m_threadMutex; ///< Thread mutex
|
||||
Status m_threadStartState; ///< State the thread starts in (Playing, Paused, Stopped)
|
||||
bool m_isStreaming; ///< Streaming state (true = playing, false = stopped)
|
||||
unsigned int m_buffers[BufferCount]; ///< Sound buffers used to store temporary audio data
|
||||
unsigned int m_channelCount; ///< Number of channels (1 = mono, 2 = stereo, ...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue