Added SetPlayingOffset to sf::SoundStream and sf::Music

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1076 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2009-04-10 22:50:08 +00:00
parent 364b0ae9b1
commit 22c225c64f
17 changed files with 202 additions and 166 deletions

View file

@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/SoundStream.hpp>
#include <SFML/System/Mutex.hpp>
#include <string>
#include <vector>
@ -94,24 +95,25 @@ public :
private :
////////////////////////////////////////////////////////////
/// /see SoundStream::OnStart
///
////////////////////////////////////////////////////////////
virtual bool OnStart();
////////////////////////////////////////////////////////////
/// /see SoundStream::OnGetData
///
////////////////////////////////////////////////////////////
virtual bool OnGetData(Chunk& Data);
////////////////////////////////////////////////////////////
/// /see SoundStream::OnSeek
///
////////////////////////////////////////////////////////////
virtual void OnSeek(float TimeOffset);
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::SoundFile* myFile; ///< Sound file
float myDuration; ///< Music duration, in seconds
std::vector<Int16> mySamples; ///< Temporary buffer of samples
Mutex myMutex; ///< Mutex protecting the data
};
} // namespace sf

View file

@ -114,6 +114,14 @@ public :
////////////////////////////////////////////////////////////
Status GetStatus() const;
////////////////////////////////////////////////////////////
/// Set the current playing position of the stream
///
/// \param TimeOffset : New playing position, expressed in seconds
///
////////////////////////////////////////////////////////////
void SetPlayingOffset(float TimeOffset);
////////////////////////////////////////////////////////////
/// Get the current playing position of the stream
///
@ -164,14 +172,6 @@ private :
////////////////////////////////////////////////////////////
virtual void Run();
////////////////////////////////////////////////////////////
/// Called when the sound restarts
///
/// \return If false is returned, the playback is aborted
///
////////////////////////////////////////////////////////////
virtual bool OnStart();
////////////////////////////////////////////////////////////
/// Called each time new audio data is needed to feed the stream
///
@ -182,6 +182,14 @@ private :
////////////////////////////////////////////////////////////
virtual bool OnGetData(Chunk& Data) = 0;
////////////////////////////////////////////////////////////
/// Called to move the current reading position
///
/// \param TimeOffset : New read position, expressed in seconds
///
////////////////////////////////////////////////////////////
virtual void OnSeek(float TimeOffset) = 0;
////////////////////////////////////////////////////////////
/// Fill a new buffer with audio data, and push it to the
/// playing queue