mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #220 from magumagu/audio-handling-cleanup-v2
Audio handling cleanup v2
This commit is contained in:
@ -26,8 +26,13 @@ SoundStream *soundStream = nullptr;
|
||||
|
||||
namespace AudioCommon
|
||||
{
|
||||
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd)
|
||||
SoundStream *InitSoundStream(void *hWnd)
|
||||
{
|
||||
unsigned int AISampleRate, DACSampleRate;
|
||||
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
|
||||
delete soundStream;
|
||||
CMixer *mixer = new CMixer(AISampleRate, DACSampleRate, 48000);
|
||||
|
||||
// TODO: possible memleak with mixer
|
||||
|
||||
std::string backend = SConfig::GetInstance().sBackend;
|
||||
@ -128,15 +133,6 @@ namespace AudioCommon
|
||||
return backends;
|
||||
}
|
||||
|
||||
bool UseJIT()
|
||||
{
|
||||
if (!Movie::IsDSPHLE() && Movie::IsPlayingInput() && Movie::IsConfigSaved())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return SConfig::GetInstance().m_DSPEnableJIT;
|
||||
}
|
||||
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
{
|
||||
if (soundStream)
|
||||
@ -163,4 +159,25 @@ namespace AudioCommon
|
||||
soundStream->SetVolume(SConfig::GetInstance().m_Volume);
|
||||
}
|
||||
}
|
||||
|
||||
void ClearAudioBuffer(bool mute)
|
||||
{
|
||||
if (soundStream)
|
||||
soundStream->Clear(mute);
|
||||
}
|
||||
|
||||
void SendAIBuffer(short *samples, unsigned int num_samples)
|
||||
{
|
||||
if (!soundStream)
|
||||
return;
|
||||
|
||||
CMixer* pMixer = soundStream->GetMixer();
|
||||
|
||||
if (pMixer && samples)
|
||||
{
|
||||
pMixer->PushSamples(samples, num_samples);
|
||||
}
|
||||
|
||||
soundStream->Update();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user