Merge pull request #5190 from ligfx/removeao
Remove libao sound backend
This commit is contained in:
commit
22fa199caf
|
@ -1,42 +0,0 @@
|
||||||
# - Find AO library
|
|
||||||
# This module defines
|
|
||||||
# AO_INCLUDE_DIR
|
|
||||||
# AO_LIBRARIES
|
|
||||||
# AO_FOUND
|
|
||||||
#
|
|
||||||
# vim: expandtab sw=4 ts=4 sts=4:
|
|
||||||
|
|
||||||
include(FindPkgConfig)
|
|
||||||
pkg_check_modules (AO_PKG QUIET ao)
|
|
||||||
|
|
||||||
find_path(AO_INCLUDE_DIR NAMES ao/ao.h
|
|
||||||
PATHS
|
|
||||||
${AO_PKG_INCLUDE_DIRS}
|
|
||||||
/usr/include/ao
|
|
||||||
/usr/include
|
|
||||||
/usr/local/include/ao
|
|
||||||
/usr/local/include
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(AO_LIBRARIES NAMES ao
|
|
||||||
PATHS
|
|
||||||
${AO_PKG_LIBRARY_DIRS}
|
|
||||||
/usr/lib
|
|
||||||
/usr/local/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(AO
|
|
||||||
REQUIRED_VARS AO_LIBRARIES AO_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if(AO_FOUND)
|
|
||||||
if(NOT TARGET AO::AO)
|
|
||||||
add_library(AO::AO UNKNOWN IMPORTED)
|
|
||||||
set_target_properties(AO::AO PROPERTIES
|
|
||||||
IMPORTED_LOCATION ${AO_LIBRARIES}
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${AO_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(AO_INCLUDE_DIR AO_LIBRARIES)
|
|
|
@ -21,7 +21,6 @@ option(ENABLE_LTO "Enables Link Time Optimization" OFF)
|
||||||
option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF)
|
option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF)
|
||||||
option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
|
option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
|
||||||
option(ENABLE_ALSA "Enables ALSA sound backend" ON)
|
option(ENABLE_ALSA "Enables ALSA sound backend" ON)
|
||||||
option(ENABLE_AO "Enables libao sound backend" ON)
|
|
||||||
option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON)
|
option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON)
|
||||||
option(ENABLE_OPENAL "Enables OpenAL sound backend" ON)
|
option(ENABLE_OPENAL "Enables OpenAL sound backend" ON)
|
||||||
option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON)
|
option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON)
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
// Copyright 2008 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "AudioCommon/AOSoundStream.h"
|
|
||||||
#include "AudioCommon/Mixer.h"
|
|
||||||
#include "Common/Logging/Log.h"
|
|
||||||
#include "Common/MsgHandler.h"
|
|
||||||
|
|
||||||
#if defined(HAVE_AO) && HAVE_AO
|
|
||||||
|
|
||||||
void AOSound::SoundLoop()
|
|
||||||
{
|
|
||||||
Common::SetCurrentThreadName("Audio thread - ao");
|
|
||||||
|
|
||||||
uint_32 numBytesToRender = 256;
|
|
||||||
ao_initialize();
|
|
||||||
default_driver = ao_default_driver_id();
|
|
||||||
format.bits = 16;
|
|
||||||
format.channels = 2;
|
|
||||||
format.rate = m_mixer->GetSampleRate();
|
|
||||||
format.byte_format = AO_FMT_LITTLE;
|
|
||||||
|
|
||||||
device = ao_open_live(default_driver, &format, nullptr /* no options */);
|
|
||||||
if (!device)
|
|
||||||
{
|
|
||||||
PanicAlertT("AudioCommon: Error opening AO device.\n");
|
|
||||||
ao_shutdown();
|
|
||||||
Stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf_size = format.bits / 8 * format.channels * format.rate;
|
|
||||||
|
|
||||||
while (m_run_thread.IsSet())
|
|
||||||
{
|
|
||||||
m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
|
|
||||||
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lk(soundCriticalSection);
|
|
||||||
ao_play(device, (char*)realtimeBuffer, numBytesToRender);
|
|
||||||
}
|
|
||||||
|
|
||||||
soundSyncEvent.Wait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AOSound::Start()
|
|
||||||
{
|
|
||||||
m_run_thread.Set();
|
|
||||||
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
|
|
||||||
|
|
||||||
thread = std::thread(&AOSound::SoundLoop, this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOSound::Update()
|
|
||||||
{
|
|
||||||
soundSyncEvent.Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOSound::Stop()
|
|
||||||
{
|
|
||||||
m_run_thread.Clear();
|
|
||||||
soundSyncEvent.Set();
|
|
||||||
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lk(soundCriticalSection);
|
|
||||||
thread.join();
|
|
||||||
|
|
||||||
if (device)
|
|
||||||
ao_close(device);
|
|
||||||
|
|
||||||
ao_shutdown();
|
|
||||||
|
|
||||||
device = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,42 +0,0 @@
|
||||||
// Copyright 2008 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include "AudioCommon/SoundStream.h"
|
|
||||||
#include "Common/Event.h"
|
|
||||||
#include "Common/Thread.h"
|
|
||||||
|
|
||||||
#if defined(HAVE_AO) && HAVE_AO
|
|
||||||
#include <ao/ao.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class AOSound final : public SoundStream
|
|
||||||
{
|
|
||||||
#if defined(HAVE_AO) && HAVE_AO
|
|
||||||
std::thread thread;
|
|
||||||
Common::Flag m_run_thread;
|
|
||||||
std::mutex soundCriticalSection;
|
|
||||||
Common::Event soundSyncEvent;
|
|
||||||
|
|
||||||
int buf_size;
|
|
||||||
|
|
||||||
ao_device* device;
|
|
||||||
ao_sample_format format;
|
|
||||||
int default_driver;
|
|
||||||
|
|
||||||
short realtimeBuffer[1024 * 1024];
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool Start() override;
|
|
||||||
void SoundLoop() override;
|
|
||||||
void Stop() override;
|
|
||||||
void Update() override;
|
|
||||||
|
|
||||||
static bool isValid() { return true; }
|
|
||||||
#endif
|
|
||||||
};
|
|
|
@ -3,7 +3,6 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "AudioCommon/AudioCommon.h"
|
#include "AudioCommon/AudioCommon.h"
|
||||||
#include "AudioCommon/AOSoundStream.h"
|
|
||||||
#include "AudioCommon/AlsaSoundStream.h"
|
#include "AudioCommon/AlsaSoundStream.h"
|
||||||
#include "AudioCommon/CoreAudioSoundStream.h"
|
#include "AudioCommon/CoreAudioSoundStream.h"
|
||||||
#include "AudioCommon/Mixer.h"
|
#include "AudioCommon/Mixer.h"
|
||||||
|
@ -42,8 +41,6 @@ void InitSoundStream()
|
||||||
else if (XAudio2_7::isValid())
|
else if (XAudio2_7::isValid())
|
||||||
g_sound_stream = std::make_unique<XAudio2_7>();
|
g_sound_stream = std::make_unique<XAudio2_7>();
|
||||||
}
|
}
|
||||||
else if (backend == BACKEND_AOSOUND && AOSound::isValid())
|
|
||||||
g_sound_stream = std::make_unique<AOSound>();
|
|
||||||
else if (backend == BACKEND_ALSA && AlsaSound::isValid())
|
else if (backend == BACKEND_ALSA && AlsaSound::isValid())
|
||||||
g_sound_stream = std::make_unique<AlsaSound>();
|
g_sound_stream = std::make_unique<AlsaSound>();
|
||||||
else if (backend == BACKEND_COREAUDIO && CoreAudioSound::isValid())
|
else if (backend == BACKEND_COREAUDIO && CoreAudioSound::isValid())
|
||||||
|
@ -115,8 +112,6 @@ std::vector<std::string> GetSoundBackends()
|
||||||
backends.push_back(BACKEND_NULLSOUND);
|
backends.push_back(BACKEND_NULLSOUND);
|
||||||
if (XAudio2_7::isValid() || XAudio2::isValid())
|
if (XAudio2_7::isValid() || XAudio2::isValid())
|
||||||
backends.push_back(BACKEND_XAUDIO2);
|
backends.push_back(BACKEND_XAUDIO2);
|
||||||
if (AOSound::isValid())
|
|
||||||
backends.push_back(BACKEND_AOSOUND);
|
|
||||||
if (AlsaSound::isValid())
|
if (AlsaSound::isValid())
|
||||||
backends.push_back(BACKEND_ALSA);
|
backends.push_back(BACKEND_ALSA);
|
||||||
if (CoreAudioSound::isValid())
|
if (CoreAudioSound::isValid())
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="aldlist.h" />
|
<ClInclude Include="aldlist.h" />
|
||||||
<ClInclude Include="AlsaSoundStream.h" />
|
<ClInclude Include="AlsaSoundStream.h" />
|
||||||
<ClInclude Include="AOSoundStream.h" />
|
|
||||||
<ClInclude Include="AudioCommon.h" />
|
<ClInclude Include="AudioCommon.h" />
|
||||||
<ClInclude Include="CoreAudioSoundStream.h" />
|
<ClInclude Include="CoreAudioSoundStream.h" />
|
||||||
<ClInclude Include="DPL2Decoder.h" />
|
<ClInclude Include="DPL2Decoder.h" />
|
||||||
|
|
|
@ -30,9 +30,6 @@
|
||||||
<ClInclude Include="DPL2Decoder.h" />
|
<ClInclude Include="DPL2Decoder.h" />
|
||||||
<ClInclude Include="Mixer.h" />
|
<ClInclude Include="Mixer.h" />
|
||||||
<ClInclude Include="WaveFile.h" />
|
<ClInclude Include="WaveFile.h" />
|
||||||
<ClInclude Include="AOSoundStream.h">
|
|
||||||
<Filter>SoundStreams</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="NullSoundStream.h">
|
<ClInclude Include="NullSoundStream.h">
|
||||||
<Filter>SoundStreams</Filter>
|
<Filter>SoundStreams</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -29,20 +29,6 @@ else()
|
||||||
message(STATUS "ALSA explicitly disabled, disabling ALSA sound backend")
|
message(STATUS "ALSA explicitly disabled, disabling ALSA sound backend")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_AO)
|
|
||||||
find_package(AO)
|
|
||||||
if(AO_FOUND)
|
|
||||||
message(STATUS "ao found, enabling ao sound backend")
|
|
||||||
target_sources(audiocommon PRIVATE AOSoundStream.cpp)
|
|
||||||
target_link_libraries(audiocommon PRIVATE AO::AO)
|
|
||||||
target_compile_definitions(audiocommon PRIVATE HAVE_AO=1)
|
|
||||||
else()
|
|
||||||
message(STATUS "ao NOT found, disabling ao sound backend")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "ao explicitly disabled, disabling ao sound backend")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_OPENAL)
|
if(ENABLE_OPENAL)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/Externals/OpenAL)
|
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/Externals/OpenAL)
|
||||||
|
|
|
@ -32,7 +32,6 @@ class TMDReader;
|
||||||
// DSP Backend Types
|
// DSP Backend Types
|
||||||
#define BACKEND_NULLSOUND _trans("No audio output")
|
#define BACKEND_NULLSOUND _trans("No audio output")
|
||||||
#define BACKEND_ALSA "ALSA"
|
#define BACKEND_ALSA "ALSA"
|
||||||
#define BACKEND_AOSOUND "AOSound"
|
|
||||||
#define BACKEND_COREAUDIO "CoreAudio"
|
#define BACKEND_COREAUDIO "CoreAudio"
|
||||||
#define BACKEND_OPENAL "OpenAL"
|
#define BACKEND_OPENAL "OpenAL"
|
||||||
#define BACKEND_PULSEAUDIO "Pulse"
|
#define BACKEND_PULSEAUDIO "Pulse"
|
||||||
|
|
Loading…
Reference in New Issue