diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2014-03-30 13:24:52 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2014-03-30 13:24:52 +0200 |
| commit | 76fafb1c7b0f743b4e66643f099262bea9130f0a (patch) | |
| tree | 4e6a996ea4da024d50bad7148d841d34598a78cf /Source/Core/AudioCommon/AudioCommon.cpp | |
| parent | 9b031786730594dd2c12ef0385fa22b76f172e2d (diff) | |
| parent | 3afa17f752a06c438d912c85519d3edb34023447 (diff) | |
Merge pull request #220 from magumagu/audio-handling-cleanup-v2
Audio handling cleanup v2
Diffstat (limited to 'Source/Core/AudioCommon/AudioCommon.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/AudioCommon.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp index 9ac53eb118..c476fe6a5c 100644 --- a/Source/Core/AudioCommon/AudioCommon.cpp +++ b/Source/Core/AudioCommon/AudioCommon.cpp @@ -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(); + } } |
