mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-27 08:35:39 +00:00
af9b9f732f
SDL_mixer is not in the standard SDL distribution. The mixing is now done using regular SDL_Audio functions. AudioManager is converted to a singleton and std::shared_ptrs are used for all Sound objects. Note that for GCC "-std=c++11" might need to be added to the CMAKE_CXX_FLAGS.
32 lines
568 B
C++
32 lines
568 B
C++
#ifndef _AUDIOMANAGER_H_
|
|
#define _AUDIOMANAGER_H_
|
|
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
#include "SDL_audio.h"
|
|
|
|
#include "Sound.h"
|
|
|
|
|
|
class AudioManager
|
|
{
|
|
static SDL_AudioSpec sAudioFormat;
|
|
static std::vector<std::shared_ptr<Sound>> sSoundVector;
|
|
static std::shared_ptr<AudioManager> sInstance;
|
|
|
|
static void mixAudio(void *unused, Uint8 *stream, int len);
|
|
|
|
AudioManager();
|
|
|
|
public:
|
|
static void registerSound(std::shared_ptr<Sound> & sound);
|
|
static void unregisterSound(std::shared_ptr<Sound> & sound);
|
|
|
|
static void play();
|
|
|
|
virtual ~AudioManager();
|
|
};
|
|
|
|
#endif
|