Working on audio in web part 1
This commit is contained in:
1 parent
3778a603f2
commit
b6e0422d71
9 files changed
+65
-13
No files matched your search
@@ -5,11 +5,14 @@
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
#include <SDL2/SDL.h>
|
||||
#endif
|
||||
|
||||
class AudioPlayerAsync {
|
||||
public:
|
||||
@@ -30,12 +33,14 @@ public:
|
||||
void exit() { stop = true; }
|
||||
|
||||
private:
|
||||
#ifndef __EMSCRIPTEN__
|
||||
void workerThread();
|
||||
|
||||
std::thread worker;
|
||||
std::mutex mtx;
|
||||
std::condition_variable cv;
|
||||
std::queue<std::function<void()>> taskQueue;
|
||||
#endif
|
||||
bool stop = false;
|
||||
|
||||
std::unordered_map<std::string, Mix_Chunk*> soundCache;
|
||||
|
||||
Reference in new issue
Block a user