ES-DE/es-core/src/AudioManager.h
Leon Styhre 76aa239855 Initial update to make the application build and run on Windows.
Much more work will be needed to get the Windows port working properly.
2020-07-03 20:23:51 +02:00

48 lines
891 B
C++

//
// AudioManager.h
//
// Low-level audio functions (using SDL2).
//
#pragma once
#ifndef ES_CORE_AUDIO_MANAGER_H
#define ES_CORE_AUDIO_MANAGER_H
#if defined(__linux__) || defined (_WIN64)
#include <SDL2/SDL_audio.h>
#else
#include "SDL_audio.h"
#endif
#include <memory>
#include <vector>
class Sound;
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 std::shared_ptr<AudioManager> & getInstance();
void init();
void deinit();
void registerSound(std::shared_ptr<Sound> & sound);
void unregisterSound(std::shared_ptr<Sound> & sound);
void play();
void stop();
virtual ~AudioManager();
};
#endif // ES_CORE_AUDIO_MANAGER_H