5 #ifndef __RD_MOCK_AUDIO_MANAGER_HPP__
6 #define __RD_MOCK_AUDIO_MANAGER_HPP__
12 #include <yarp/os/PeriodicThread.h>
14 #include "AudioManager.hpp"
25 public yarp::os::PeriodicThread
30 bool isPlaying(
const std::string&
id)
const;
34 bool load(
const std::string& music_filepath,
const std::string&
id,
const int& type);
35 bool play(
const std::string &
id,
int loop);
55 static const std::string
id;
83 std::map<std::string, int> durations;
87 std::map<std::string, int> loop_times;
94 #endif //-- __RD_MOCK_AUDIO_MANAGER_HPP__
Music and sound effects manager.
Definition: AudioManager.hpp:28
virtual bool stop()
Stops the AudioManager.
Definition: MockAudioManager.cpp:147
void run()
Method called periodically from the PeriodicThread class. It simply calls the update() method.
Definition: MockAudioManager.cpp:21
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
bool isPlaying(const std::string &id) const
Whether the sound with the given id is being played or not.
Definition: MockAudioManager.cpp:52
bool stopMusic()
Stops the music being played currently.
Definition: MockAudioManager.cpp:122
Mock music and sound effects manager for testing purposes.
Definition: MockAudioManager.hpp:24
virtual ~MockAudioManager()
Destructor. Used to reset the local static reference after destroying this manager.
Definition: MockAudioManager.cpp:171
MockAudioManager()
Constructor.
Definition: MockAudioManager.cpp:16
virtual bool isStopped() const
True if the manager is not active.
Definition: MockAudioManager.cpp:156
std::mutex loop_times_mutex
Dictionary for loop times.
Definition: MockAudioManager.hpp:86
static MockAudioManager * uniqueInstance
Stores the unique instance of the AudioManager.
Definition: MockAudioManager.hpp:79
static bool RegisterManager()
Register this manager in the AudioManager registry so that can be used.
Definition: MockAudioManager.cpp:161
bool play(const std::string &id, int loop)
Plays a music/sound effect file previously loaded.
Definition: MockAudioManager.cpp:100
virtual bool start()
Start the AudioManager.
Definition: MockAudioManager.cpp:141
static const int UPDATE_PERIOD
Thread update period (ms)
Definition: MockAudioManager.hpp:61
bool load(const std::string &music_filepath, const std::string &id, const int &type)
Loads an audio file, assigning it a string as identifier.
Definition: MockAudioManager.cpp:78
static const std::string id
String that identifies this manager.
Definition: MockAudioManager.hpp:55
static const int AUDIO_DURATION
Default duration (s)
Definition: MockAudioManager.hpp:58
std::mutex durations_mutex
Dictionary for sound durations:
Definition: MockAudioManager.hpp:82