Added the sf::Time class
This commit is contained in:
parent
e775bd0169
commit
4116ad033c
58 changed files with 880 additions and 227 deletions
|
@ -30,6 +30,7 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/SoundStream.hpp>
|
||||
#include <SFML/System/Mutex.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -121,10 +122,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the total duration of the music
|
||||
///
|
||||
/// \return Music duration, in milliseconds
|
||||
/// \return Music duration
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 GetDuration() const;
|
||||
Time GetDuration() const;
|
||||
|
||||
protected :
|
||||
|
||||
|
@ -144,10 +145,10 @@ protected :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current playing position in the stream source
|
||||
///
|
||||
/// \param timeOffset New playing position, in milliseconds
|
||||
/// \param timeOffset New playing position, from the beginning of the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnSeek(Uint32 timeOffset);
|
||||
virtual void OnSeek(Time timeOffset);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -161,7 +162,7 @@ private :
|
|||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
priv::SoundFile* myFile; ///< Sound file
|
||||
Uint32 myDuration; ///< Music duration, in milliseconds
|
||||
Time myDuration; ///< Music duration
|
||||
std::vector<Int16> mySamples; ///< Temporary buffer of samples
|
||||
Mutex myMutex; ///< Mutex protecting the data
|
||||
};
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/SoundSource.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
@ -144,12 +145,12 @@ public :
|
|||
/// The playing position can be changed when the sound is
|
||||
/// either paused or playing.
|
||||
///
|
||||
/// \param timeOffset New playing position, in milliseconds
|
||||
/// \param timeOffset New playing position, from the beginning of the sound
|
||||
///
|
||||
/// \see GetPlayingOffset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPlayingOffset(Uint32 timeOffset);
|
||||
void SetPlayingOffset(Time timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the audio buffer attached to the sound
|
||||
|
@ -172,12 +173,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current playing position of the sound
|
||||
///
|
||||
/// \return Current playing position, in milliseconds
|
||||
/// \return Current playing position, from the beginning of the sound
|
||||
///
|
||||
/// \see SetPlayingOffset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 GetPlayingOffset() const;
|
||||
Time GetPlayingOffset() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current status of the sound (stopped, paused, playing)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
@ -212,12 +213,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the total duration of the sound
|
||||
///
|
||||
/// \return Sound duration, in milliseconds
|
||||
/// \return Sound duration
|
||||
///
|
||||
/// \see GetSampleRate, GetChannelCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 GetDuration() const;
|
||||
Time GetDuration() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of assignment operator
|
||||
|
@ -280,7 +281,7 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
unsigned int myBuffer; ///< OpenAL buffer identifier
|
||||
std::vector<Int16> mySamples; ///< Samples buffer
|
||||
Uint32 myDuration; ///< Sound duration, in milliseconds
|
||||
Time myDuration; ///< Sound duration
|
||||
mutable SoundList mySounds; ///< List of sounds that are using this buffer
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/SoundSource.hpp>
|
||||
#include <SFML/System/Thread.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
@ -131,22 +132,22 @@ public :
|
|||
/// The playing position can be changed when the stream is
|
||||
/// either paused or playing.
|
||||
///
|
||||
/// \param timeOffset New playing position, in milliseconds
|
||||
/// \param timeOffset New playing position, from the beginning of the stream
|
||||
///
|
||||
/// \see GetPlayingOffset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPlayingOffset(Uint32 timeOffset);
|
||||
void SetPlayingOffset(Time timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current playing position of the stream
|
||||
///
|
||||
/// \return Current playing position, in milliseconds
|
||||
/// \return Current playing position, from the beginning of the stream
|
||||
///
|
||||
/// \see SetPlayingOffset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 GetPlayingOffset() const;
|
||||
Time GetPlayingOffset() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set whether or not the stream should loop after reaching the end
|
||||
|
@ -232,10 +233,10 @@ private :
|
|||
/// This function must be overriden by derived classes to
|
||||
/// allow random seeking into the stream source.
|
||||
///
|
||||
/// \param timeOffset New playing position, in milliseconds
|
||||
/// \param timeOffset New playing position, relative to the beginning of the stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnSeek(Uint32 timeOffset) = 0;
|
||||
virtual void OnSeek(Time timeOffset) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Fill a new buffer with audio samples, and append
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue