Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////
- //
- // SFML - Simple and Fast Multimedia Library
- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
- //
- // This software is provided 'as-is', without any express or implied warranty.
- // In no event will the authors be held liable for any damages arising from the use of this software.
- //
- // Permission is granted to anyone to use this software for any purpose,
- // including commercial applications, and to alter it and redistribute it freely,
- // subject to the following restrictions:
- //
- // 1. The origin of this software must not be misrepresented;
- // you must not claim that you wrote the original software.
- // If you use this software in a product, an acknowledgment
- // in the product documentation would be appreciated but is not required.
- //
- // 2. Altered source versions must be plainly marked as such,
- // and must not be misrepresented as being the original software.
- //
- // 3. This notice may not be removed or altered from any source distribution.
- //
- ////////////////////////////////////////////////////////////
- #ifndef SFML_PLAYLIST_HPP
- #define SFML_PLAYLIST_HPP
- ////////////////////////////////////////////////////////////
- // Headers
- ////////////////////////////////////////////////////////////
- #include <SFML/Audio/SoundStream.hpp>
- #include <SFML/System/Mutex.hpp>
- #include <SFML/System/Time.hpp>
- #include <string>
- #include <vector>
- namespace sf {
- namespace priv {
- class SoundFile;
- ////////////////////////////////////////////////////////////
- /// \brief Structure defining an item from the playlist
- ///
- ////////////////////////////////////////////////////////////
- class Item {
- public :
- priv::SoundFile* myFile;
- Time start;
- Time duration;
- unsigned int returnTo;
- unsigned int returnCount;
- unsigned int timesReturned;
- };
- }
- class SFML_AUDIO_API Playlist : public SoundStream {
- public :
- Playlist(std::size_t BufferSize = 44100);
- ~Playlist();
- unsigned int AddItem(std::string file, Time start = Time::Zero, Time end = Time::Zero, unsigned int returnTo = 0, int returnCount = 0);
- void SetRepeat(bool repeat);
- void Stop();
- Time GetDuration() const;
- static const int ALWAYS_RETURN;
- private :
- virtual void OnSeek(Time time);
- virtual bool OnStart();
- virtual bool OnGetData(Chunk& Data);
- std::vector<priv::Item*> items;
- unsigned int currentItem;
- bool reset;
- Time offset;
- bool repeat;
- Time myDuration;
- std::vector<Int16> mySamples;
- Mutex myMutex;
- };
- } // namespace sf
- #endif // SFML_PLAYLIST_HPP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement