PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
audio.h
1#pragma once
2
3#include <functional>
4#include <memory>
5
6namespace pixelbullet
7{
8class Filesystem;
9class VirtualPath;
10
14class Audio
15{
16public:
17 explicit Audio(Filesystem& filesystem);
18 ~Audio();
19
20 Audio(const Audio&) = delete;
21 Audio& operator=(const Audio&) = delete;
22
24 void PlaySound(const VirtualPath& filePath, bool loop = false);
25
26private:
28 bool Init();
30 void Shutdown();
32 void AudioThreadLoop();
34 void SubmitCommand(const std::function<void()>& command);
35
36private:
37 struct State;
38
39 Filesystem& filesystem_;
40 std::unique_ptr<State> state_;
41};
42} // namespace pixelbullet
Definition audio.h:15
void PlaySound(const VirtualPath &filePath, bool loop=false)
Play a sound given its file path. If loop is true the sound will restart endlessly.
Definition audio.cc:64
Definition filesystem.h:16
Definition virtual_path.h:10
Definition audio.cc:15