mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
36 lines
569 B
C++
36 lines
569 B
C++
#include "Audio.h"
|
|
namespace MiniEngine
|
|
{
|
|
AudioPlayer::AudioPlayer()
|
|
{
|
|
if (!_sysAudioCounter)
|
|
{
|
|
_sysAudio = new _Audio;
|
|
}
|
|
++_sysAudioCounter;
|
|
}
|
|
|
|
AudioPlayer::~AudioPlayer()
|
|
{
|
|
--_sysAudioCounter;
|
|
if (!_sysAudioCounter)
|
|
{
|
|
delete _sysAudio;
|
|
}
|
|
}
|
|
|
|
AudioPlayer::_Audio::_Audio()
|
|
{
|
|
Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024);
|
|
}
|
|
|
|
AudioPlayer::_Audio::~_Audio()
|
|
{
|
|
Mix_CloseAudio();
|
|
}
|
|
|
|
AudioPlayer::_Audio* AudioPlayer::_sysAudio = nullptr;
|
|
int AudioPlayer::_sysAudioCounter = 0;
|
|
} /// End of namespace MiniEngine
|
|
|