ES-DE/es-core/src/AudioManager.h

45 lines
908 B
C
Raw Normal View History

// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// AudioManager.h
//
// Low-level audio functions (using SDL2).
//
#ifndef ES_CORE_AUDIO_MANAGER_H
#define ES_CORE_AUDIO_MANAGER_H
#include <SDL2/SDL_audio.h>
#include <memory>
2017-11-01 22:21:10 +00:00
#include <vector>
2017-11-01 22:21:10 +00:00
class Sound;
class AudioManager
{
static SDL_AudioSpec sAudioFormat;
static std::vector<std::shared_ptr<Sound>> sSoundVector;
static std::shared_ptr<AudioManager> sInstance;
2020-10-18 17:45:26 +00:00
static void mixAudio(void* unused, Uint8* stream, int len);
AudioManager();
public:
static SDL_AudioDeviceID sAudioDevice;
2020-10-18 17:45:26 +00:00
static std::shared_ptr<AudioManager>& getInstance();
void init();
void deinit();
2020-10-18 17:45:26 +00:00
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