mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
34 lines
556 B
C++
34 lines
556 B
C++
|
#include "Audio.h"
|
||
|
#include "begin_code.h"
|
||
|
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;
|
||
|
#include "end_code.h"
|