mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Merge pull request #5190 from ligfx/removeao
Remove libao sound backend
This commit is contained in:
@ -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.
|
||||
|
||||
#include "AudioCommon/AudioCommon.h"
|
||||
#include "AudioCommon/AOSoundStream.h"
|
||||
#include "AudioCommon/AlsaSoundStream.h"
|
||||
#include "AudioCommon/CoreAudioSoundStream.h"
|
||||
#include "AudioCommon/Mixer.h"
|
||||
@ -42,8 +41,6 @@ void InitSoundStream()
|
||||
else if (XAudio2_7::isValid())
|
||||
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())
|
||||
g_sound_stream = std::make_unique<AlsaSound>();
|
||||
else if (backend == BACKEND_COREAUDIO && CoreAudioSound::isValid())
|
||||
@ -115,8 +112,6 @@ std::vector<std::string> GetSoundBackends()
|
||||
backends.push_back(BACKEND_NULLSOUND);
|
||||
if (XAudio2_7::isValid() || XAudio2::isValid())
|
||||
backends.push_back(BACKEND_XAUDIO2);
|
||||
if (AOSound::isValid())
|
||||
backends.push_back(BACKEND_AOSOUND);
|
||||
if (AlsaSound::isValid())
|
||||
backends.push_back(BACKEND_ALSA);
|
||||
if (CoreAudioSound::isValid())
|
||||
|
@ -50,7 +50,6 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="aldlist.h" />
|
||||
<ClInclude Include="AlsaSoundStream.h" />
|
||||
<ClInclude Include="AOSoundStream.h" />
|
||||
<ClInclude Include="AudioCommon.h" />
|
||||
<ClInclude Include="CoreAudioSoundStream.h" />
|
||||
<ClInclude Include="DPL2Decoder.h" />
|
||||
@ -78,4 +77,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -30,9 +30,6 @@
|
||||
<ClInclude Include="DPL2Decoder.h" />
|
||||
<ClInclude Include="Mixer.h" />
|
||||
<ClInclude Include="WaveFile.h" />
|
||||
<ClInclude Include="AOSoundStream.h">
|
||||
<Filter>SoundStreams</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="NullSoundStream.h">
|
||||
<Filter>SoundStreams</Filter>
|
||||
</ClInclude>
|
||||
@ -64,4 +61,4 @@
|
||||
<ItemGroup>
|
||||
<Text Include="CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -29,20 +29,6 @@ else()
|
||||
message(STATUS "ALSA explicitly disabled, disabling ALSA sound backend")
|
||||
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(WIN32)
|
||||
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/Externals/OpenAL)
|
||||
|
@ -32,7 +32,6 @@ class TMDReader;
|
||||
// DSP Backend Types
|
||||
#define BACKEND_NULLSOUND _trans("No audio output")
|
||||
#define BACKEND_ALSA "ALSA"
|
||||
#define BACKEND_AOSOUND "AOSound"
|
||||
#define BACKEND_COREAUDIO "CoreAudio"
|
||||
#define BACKEND_OPENAL "OpenAL"
|
||||
#define BACKEND_PULSEAUDIO "Pulse"
|
||||
|
Reference in New Issue
Block a user