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:
parent
364b0ae9b1
commit
22c225c64f
17 changed files with 202 additions and 166 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue