mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 05:15:47 -04:00
Qt: Hook up audio driver selection
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
#include "core/system.h"
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class SettingsInterface;
|
||||
|
||||
@ -33,6 +35,7 @@ void ReleaseHostDisplayResources();
|
||||
#ifdef WITH_CUBEB
|
||||
std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
|
||||
AudioStretchMode stretch);
|
||||
std::vector<std::string> GetCubebDriverNames();
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
std::unique_ptr<AudioStream> CreateXAudio2Stream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "common/string_util.h"
|
||||
#include "common_host.h"
|
||||
#include "core/host.h"
|
||||
#include "core/host_settings.h"
|
||||
#include "core/settings.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
Log_SetChannel(CubebAudioStream);
|
||||
|
||||
@ -73,9 +73,8 @@ bool CubebAudioStream::Initialize(u32 latency_ms)
|
||||
|
||||
cubeb_set_log_callback(CUBEB_LOG_NORMAL, LogCallback);
|
||||
|
||||
std::string backend(Host::GetStringSettingValue("Audio", "CubebBackend"));
|
||||
|
||||
int rv = cubeb_init(&m_context, "DuckStation", backend.empty() ? nullptr : backend.c_str());
|
||||
int rv =
|
||||
cubeb_init(&m_context, "DuckStation", g_settings.audio_driver.empty() ? nullptr : g_settings.audio_driver.c_str());
|
||||
if (rv != CUBEB_OK)
|
||||
{
|
||||
Host::ReportFormattedErrorAsync("Error", "Could not initialize cubeb context: %d", rv);
|
||||
@ -199,3 +198,12 @@ std::unique_ptr<AudioStream> CommonHost::CreateCubebAudioStream(u32 sample_rate,
|
||||
stream.reset();
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::vector<std::string> CommonHost::GetCubebDriverNames()
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
const char** cubeb_names = cubeb_get_backend_names();
|
||||
for (u32 i = 0; cubeb_names[i] != nullptr; i++)
|
||||
names.emplace_back(cubeb_names[i]);
|
||||
return names;
|
||||
}
|
||||
|
Reference in New Issue
Block a user