2015-04-11 13:20:46 +02:00
|
|
|
/**
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
2017-01-05 21:28:23 +01:00
|
|
|
* @license MPL v2.0 (see license file)
|
2015-04-11 13:20:46 +02:00
|
|
|
*/
|
2016-02-02 21:18:54 +01:00
|
|
|
#pragma once
|
2015-04-11 13:20:46 +02:00
|
|
|
|
2016-10-02 21:51:38 +02:00
|
|
|
#include <etk/types.hpp>
|
|
|
|
#include <audio/river/Interface.hpp>
|
|
|
|
#include <audio/river/Manager.hpp>
|
|
|
|
#include <audio/ess/LoadedFile.hpp>
|
2017-09-07 23:38:26 +02:00
|
|
|
#include <ethread/Mutex.hpp>
|
2017-08-28 00:08:27 +02:00
|
|
|
#include <etk/Map.hpp>
|
2015-04-11 13:20:46 +02:00
|
|
|
|
2015-07-01 23:40:25 +02:00
|
|
|
|
2015-04-11 13:20:46 +02:00
|
|
|
namespace audio {
|
|
|
|
namespace ess {
|
2015-07-01 21:03:26 +02:00
|
|
|
class Music {
|
|
|
|
private:
|
2017-09-07 23:38:26 +02:00
|
|
|
mutable ethread::Mutex m_mutex;
|
2016-07-19 21:43:58 +02:00
|
|
|
ememory::SharedPtr<audio::river::Manager> m_manager;
|
|
|
|
ememory::SharedPtr<audio::river::Interface> m_interface;
|
2015-07-01 21:03:26 +02:00
|
|
|
public:
|
2016-07-19 21:43:58 +02:00
|
|
|
Music(const ememory::SharedPtr<audio::river::Manager>& _manager);
|
2015-07-01 21:03:26 +02:00
|
|
|
~Music();
|
|
|
|
private:
|
|
|
|
void onDataNeeded(void* _data,
|
|
|
|
const audio::Time& _playTime,
|
|
|
|
const size_t& _nbChunk,
|
|
|
|
enum audio::format _format,
|
|
|
|
uint32_t _sampleRate,
|
2017-08-28 00:08:27 +02:00
|
|
|
const etk::Vector<audio::channel>& _map);
|
2016-07-19 21:43:58 +02:00
|
|
|
ememory::SharedPtr<audio::ess::LoadedFile> m_current; //!< current music read
|
2015-07-01 21:03:26 +02:00
|
|
|
int32_t m_position; //!< current position of music read
|
2017-08-28 00:08:27 +02:00
|
|
|
etk::Map<etk::String, ememory::SharedPtr<audio::ess::LoadedFile> > m_list; //!< list of all music loaded
|
2016-07-19 21:43:58 +02:00
|
|
|
ememory::SharedPtr<audio::ess::LoadedFile> m_next; //!< next music to read
|
2015-07-01 21:03:26 +02:00
|
|
|
public:
|
2017-08-28 00:08:27 +02:00
|
|
|
void load(const etk::String& _file, const etk::String& _name);
|
|
|
|
void play(const etk::String& _name);
|
2015-07-01 21:03:26 +02:00
|
|
|
void stop();
|
|
|
|
void clear();
|
2015-07-02 21:17:24 +02:00
|
|
|
};
|
2015-04-11 13:20:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|