Input & Resource Managers
This commit is contained in:
@ -17,13 +17,33 @@
|
||||
#include <AudioManager.hpp>
|
||||
#include <IAEngine/Engine.hpp>
|
||||
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
MIX_Mixer *AudioManager::s_mixer;
|
||||
|
||||
VOID AudioManager::Initialize()
|
||||
{
|
||||
if (!MIX_Init())
|
||||
THROW_UNKNOWN("Failed to initialize SDL Mixer: ", SDL_GetError());
|
||||
|
||||
if (!(s_mixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, NULL)))
|
||||
THROW_UNKNOWN(BuildString("Failed to create the SDL mixer: ", SDL_GetError()));
|
||||
}
|
||||
|
||||
VOID AudioManager::Terminate()
|
||||
{
|
||||
MIX_DestroyMixer(s_mixer);
|
||||
}
|
||||
}
|
||||
|
||||
Handle AudioManager::CreateAudio(IN PCUINT8 encodedData, IN SIZE_T encodedDataSize)
|
||||
{
|
||||
return (Handle) MIX_LoadAudio_IO(s_mixer, SDL_IOFromConstMem(encodedData, encodedDataSize), false, true);
|
||||
}
|
||||
|
||||
VOID AudioManager::DestoryAudio(IN Handle handle)
|
||||
{
|
||||
MIX_DestroyAudio((MIX_Audio*)handle);
|
||||
}
|
||||
} // namespace ia::iae
|
||||
Reference in New Issue
Block a user