forked from MrBesen/soundboard
36 lines
635 B
C++
36 lines
635 B
C++
#pragma once
|
|
|
|
#include "miniaudio.h"
|
|
|
|
#include <string>
|
|
#include <list>
|
|
#include <mutex>
|
|
#include <vector>
|
|
|
|
#include "sounddevice.h"
|
|
|
|
class Sound {
|
|
public:
|
|
static Sound& instance();
|
|
static void deinit();
|
|
|
|
void addPlayback(const std::string& name, float volume = 1.f);
|
|
bool addDefaultDevice();
|
|
bool addDeviceWithName(const std::string& name);
|
|
void stopAll();
|
|
void reset();
|
|
|
|
const static std::string FOLDER;
|
|
private:
|
|
Sound();
|
|
~Sound();
|
|
|
|
ma_context context;
|
|
|
|
std::vector<SoundDevice*> devices;
|
|
|
|
static Sound* inst;
|
|
|
|
friend void sound_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount);
|
|
};
|