Mesen-SX/Core/SoundMixer.cpp
Sour a71de2a7bf SPC: Run SPC 1 frame per frame, rather than 60 frames per frame.
+ Fixed warnings in SPC code in 64-bit mode
2019-02-21 16:49:19 -05:00

36 lines
616 B
C++

#include "stdafx.h"
#include "SoundMixer.h"
SoundMixer::SoundMixer()
{
_audioDevice = nullptr;
_sampleRate = 32000;
}
SoundMixer::~SoundMixer()
{
}
void SoundMixer::RegisterAudioDevice(IAudioDevice *audioDevice)
{
_audioDevice = audioDevice;
}
void SoundMixer::StopAudio(bool clearBuffer)
{
if(_audioDevice) {
if(clearBuffer) {
_audioDevice->Stop();
} else {
_audioDevice->Pause();
}
}
}
void SoundMixer::PlayAudioBuffer(int16_t* samples, uint32_t sampleCount)
{
if(_audioDevice) {
_audioDevice->PlayBuffer(samples, sampleCount, _sampleRate, true);
_audioDevice->ProcessEndOfFrame();
}
}