mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-23 14:45:38 +00:00
eeae8033bd
This resolves an irritating issue in the code editor where SDL2-specific functions could't be found. Not entirely sure about the SDL include file logic for other operating systems than Linux so the #ifdef directives may need to be updated further at a later date.
48 lines
864 B
C++
48 lines
864 B
C++
//
|
|
// AudioManager.h
|
|
//
|
|
// Low-level audio functions (using SDL).
|
|
//
|
|
|
|
#pragma once
|
|
#ifndef ES_CORE_AUDIO_MANAGER_H
|
|
#define ES_CORE_AUDIO_MANAGER_H
|
|
|
|
#ifdef __linux__
|
|
#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
|