summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLeo Lam <leolino.lam@gmail.com>2017-08-01 16:42:01 +0800
committerGitHub <noreply@github.com>2017-08-01 16:42:01 +0800
commitc4b2aa88ec1385a3edfed65c02314c2cde8278fc (patch)
treea0a842d2267550918f02e1794b0dd2e0f64cbd26 /Source/Core
parent91a6f746397c66188fc3cea19cf1c1547ea69550 (diff)
parent21fa010bb66f56ed9b83e840d25c10c313b99e05 (diff)
Merge pull request #5690 from ligfx/removecoreaudio
Remove CoreAudio audio backend
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/AudioCommon/AudioCommon.cpp10
-rw-r--r--Source/Core/AudioCommon/AudioCommon.vcxproj3
-rw-r--r--Source/Core/AudioCommon/AudioCommon.vcxproj.filters3
-rw-r--r--Source/Core/AudioCommon/CMakeLists.txt3
-rw-r--r--Source/Core/AudioCommon/CoreAudioSoundStream.cpp123
-rw-r--r--Source/Core/AudioCommon/CoreAudioSoundStream.h32
-rw-r--r--Source/Core/Core/ConfigManager.h1
7 files changed, 3 insertions, 172 deletions
diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp
index 606854159c..18aa75d1ae 100644
--- a/Source/Core/AudioCommon/AudioCommon.cpp
+++ b/Source/Core/AudioCommon/AudioCommon.cpp
@@ -4,7 +4,6 @@
#include "AudioCommon/AudioCommon.h"
#include "AudioCommon/AlsaSoundStream.h"
-#include "AudioCommon/CoreAudioSoundStream.h"
#include "AudioCommon/CubebStream.h"
#include "AudioCommon/Mixer.h"
#include "AudioCommon/NullSoundStream.h"
@@ -46,8 +45,6 @@ void InitSoundStream()
}
else if (backend == BACKEND_ALSA && AlsaSound::isValid())
g_sound_stream = std::make_unique<AlsaSound>();
- else if (backend == BACKEND_COREAUDIO && CoreAudioSound::isValid())
- g_sound_stream = std::make_unique<CoreAudioSound>();
else if (backend == BACKEND_PULSEAUDIO && PulseAudio::isValid())
g_sound_stream = std::make_unique<PulseAudio>();
else if (backend == BACKEND_OPENSLES && OpenSLESStream::isValid())
@@ -101,7 +98,7 @@ std::string GetDefaultSoundBackend()
if (AlsaSound::isValid())
backend = BACKEND_ALSA;
#elif defined __APPLE__
- backend = BACKEND_COREAUDIO;
+ backend = BACKEND_CUBEB;
#elif defined _WIN32
backend = BACKEND_XAUDIO2;
#endif
@@ -118,8 +115,6 @@ std::vector<std::string> GetSoundBackends()
backends.push_back(BACKEND_XAUDIO2);
if (AlsaSound::isValid())
backends.push_back(BACKEND_ALSA);
- if (CoreAudioSound::isValid())
- backends.push_back(BACKEND_COREAUDIO);
if (PulseAudio::isValid())
backends.push_back(BACKEND_PULSEAUDIO);
if (OpenALStream::isValid())
@@ -152,8 +147,7 @@ bool SupportsVolumeChanges(const std::string& backend)
// FIXME: this one should ask the backend whether it supports it.
// but getting the backend from string etc. is probably
// too much just to enable/disable a stupid slider...
- return backend == BACKEND_COREAUDIO || backend == BACKEND_CUBEB || backend == BACKEND_OPENAL ||
- backend == BACKEND_XAUDIO2;
+ return backend == BACKEND_CUBEB || backend == BACKEND_OPENAL || backend == BACKEND_XAUDIO2;
}
void UpdateSoundStream()
diff --git a/Source/Core/AudioCommon/AudioCommon.vcxproj b/Source/Core/AudioCommon/AudioCommon.vcxproj
index 1429782557..5040cb6c6c 100644
--- a/Source/Core/AudioCommon/AudioCommon.vcxproj
+++ b/Source/Core/AudioCommon/AudioCommon.vcxproj
@@ -54,7 +54,6 @@
<ClInclude Include="AlsaSoundStream.h" />
<ClInclude Include="AudioCommon.h" />
<ClInclude Include="AudioStretcher.h" />
- <ClInclude Include="CoreAudioSoundStream.h" />
<ClInclude Include="CubebStream.h" />
<ClInclude Include="CubebUtils.h" />
<ClInclude Include="DPL2Decoder.h" />
@@ -82,4 +81,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/Source/Core/AudioCommon/AudioCommon.vcxproj.filters b/Source/Core/AudioCommon/AudioCommon.vcxproj.filters
index 9d7975c53f..48c93879be 100644
--- a/Source/Core/AudioCommon/AudioCommon.vcxproj.filters
+++ b/Source/Core/AudioCommon/AudioCommon.vcxproj.filters
@@ -53,9 +53,6 @@
<ClInclude Include="OpenSLESStream.h">
<Filter>SoundStreams</Filter>
</ClInclude>
- <ClInclude Include="CoreAudioSoundStream.h">
- <Filter>SoundStreams</Filter>
- </ClInclude>
<ClInclude Include="AlsaSoundStream.h">
<Filter>SoundStreams</Filter>
</ClInclude>
diff --git a/Source/Core/AudioCommon/CMakeLists.txt b/Source/Core/AudioCommon/CMakeLists.txt
index e39296d6cb..8213df5fe8 100644
--- a/Source/Core/AudioCommon/CMakeLists.txt
+++ b/Source/Core/AudioCommon/CMakeLists.txt
@@ -67,9 +67,6 @@ if(WIN32)
else()
message(FATAL_ERROR "OpenAL NOT found in Externals")
endif()
-
-elseif(APPLE)
- target_sources(audiocommon PRIVATE CoreAudioSoundStream.cpp)
endif()
target_link_libraries(audiocommon PRIVATE cubeb SoundTouch)
diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
deleted file mode 100644
index 54ba660129..0000000000
--- a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2009 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#include <AudioUnit/AudioUnit.h>
-
-#include "AudioCommon/CoreAudioSoundStream.h"
-#include "Common/Logging/Log.h"
-
-OSStatus CoreAudioSound::callback(void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags,
- const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
- UInt32 inNumberFrames, AudioBufferList* ioData)
-{
- for (UInt32 i = 0; i < ioData->mNumberBuffers; i++)
- ((CoreAudioSound*)inRefCon)
- ->m_mixer->Mix((short*)ioData->mBuffers[i].mData, ioData->mBuffers[i].mDataByteSize / 4);
-
- return noErr;
-}
-
-bool CoreAudioSound::Start()
-{
- OSStatus err;
- AURenderCallbackStruct callback_struct;
- AudioStreamBasicDescription format;
- AudioComponentDescription desc;
- AudioComponent component;
-
- desc.componentType = kAudioUnitType_Output;
- desc.componentSubType = kAudioUnitSubType_DefaultOutput;
- desc.componentFlags = 0;
- desc.componentFlagsMask = 0;
- desc.componentManufacturer = kAudioUnitManufacturer_Apple;
- component = AudioComponentFindNext(nullptr, &desc);
- if (component == nullptr)
- {
- ERROR_LOG(AUDIO, "error finding audio component");
- return false;
- }
-
- err = AudioComponentInstanceNew(component, &audioUnit);
- if (err != noErr)
- {
- ERROR_LOG(AUDIO, "error opening audio component");
- return false;
- }
-
- FillOutASBDForLPCM(format, m_mixer->GetSampleRate(), 2, 16, 16, false, false, false);
- err = AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0,
- &format, sizeof(AudioStreamBasicDescription));
- if (err != noErr)
- {
- ERROR_LOG(AUDIO, "error setting audio format");
- return false;
- }
-
- callback_struct.inputProc = callback;
- callback_struct.inputProcRefCon = this;
- err = AudioUnitSetProperty(audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
- 0, &callback_struct, sizeof callback_struct);
- if (err != noErr)
- {
- ERROR_LOG(AUDIO, "error setting audio callback");
- return false;
- }
-
- err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0,
- m_volume / 100., 0);
- if (err != noErr)
- ERROR_LOG(AUDIO, "error setting volume");
-
- err = AudioUnitInitialize(audioUnit);
- if (err != noErr)
- {
- ERROR_LOG(AUDIO, "error initializing audiounit");
- return false;
- }
-
- err = AudioOutputUnitStart(audioUnit);
- if (err != noErr)
- {
- ERROR_LOG(AUDIO, "error starting audiounit");
- return false;
- }
-
- return true;
-}
-
-void CoreAudioSound::SetVolume(int volume)
-{
- OSStatus err;
- m_volume = volume;
-
- err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0,
- volume / 100., 0);
- if (err != noErr)
- ERROR_LOG(AUDIO, "error setting volume");
-}
-
-void CoreAudioSound::SoundLoop()
-{
-}
-
-void CoreAudioSound::Stop()
-{
- OSStatus err;
-
- err = AudioOutputUnitStop(audioUnit);
- if (err != noErr)
- ERROR_LOG(AUDIO, "error stopping audiounit");
-
- err = AudioUnitUninitialize(audioUnit);
- if (err != noErr)
- ERROR_LOG(AUDIO, "error uninitializing audiounit");
-
- err = AudioComponentInstanceDispose(audioUnit);
- if (err != noErr)
- ERROR_LOG(AUDIO, "error closing audio component");
-}
-
-void CoreAudioSound::Update()
-{
-}
diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.h b/Source/Core/AudioCommon/CoreAudioSoundStream.h
deleted file mode 100644
index 8e4f35a8e9..0000000000
--- a/Source/Core/AudioCommon/CoreAudioSoundStream.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2008 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#pragma once
-
-#ifdef __APPLE__
-#include <AudioUnit/AudioUnit.h>
-#endif
-
-#include "AudioCommon/SoundStream.h"
-
-class CoreAudioSound final : public SoundStream
-{
-#ifdef __APPLE__
-public:
- bool Start() override;
- void SetVolume(int volume) override;
- void SoundLoop() override;
- void Stop() override;
- void Update() override;
-
- static bool isValid() { return true; }
-private:
- AudioUnit audioUnit;
- int m_volume;
-
- static OSStatus callback(void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags,
- const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
- UInt32 inNumberFrames, AudioBufferList* ioData);
-#endif
-};
diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h
index 357907782d..fa31751331 100644
--- a/Source/Core/Core/ConfigManager.h
+++ b/Source/Core/Core/ConfigManager.h
@@ -35,7 +35,6 @@ class TMDReader;
// DSP Backend Types
#define BACKEND_NULLSOUND _trans("No audio output")
#define BACKEND_ALSA "ALSA"
-#define BACKEND_COREAUDIO "CoreAudio"
#define BACKEND_CUBEB "Cubeb"
#define BACKEND_OPENAL "OpenAL"
#define BACKEND_PULSEAUDIO "Pulse"