Merge pull request #2388 from fewtarius/dev

Revert "Apply default audio selection patch for Cemu."
This commit is contained in:
fewtarius 2023-11-17 06:25:54 -05:00 committed by GitHub
commit 102c3a7c1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,70 +0,0 @@
From e2b771a8a14b35738b6dedcc73bd0c9a544c29b2 Mon Sep 17 00:00:00 2001
From: Squall-Leonhart <danialhorton@hotmail.com>
Date: Wed, 8 Nov 2023 17:29:14 +1100
Subject: [PATCH] Custom Implementation for Default Device selection
Tested on Windows
Requires OSX/Linux testing.
---
src/audio/CubebAPI.cpp | 13 +++++++++----
src/audio/CubebInputAPI.cpp | 13 +++++++++----
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/audio/CubebAPI.cpp b/src/audio/CubebAPI.cpp
index 09e450113..2b4aec41f 100644
--- a/src/audio/CubebAPI.cpp
+++ b/src/audio/CubebAPI.cpp
@@ -188,15 +188,20 @@ std::vector<IAudioAPI::DeviceDescriptionPtr> CubebAPI::GetDevices()
return {};
std::vector<DeviceDescriptionPtr> result;
- result.reserve(devices.count);
+ result.reserve(devices.count + 1); // Reserve space for the default device
+
+ // Add the default device to the list
+ auto defaultDevice = std::make_shared<CubebDeviceDescription>(nullptr, "default", L"Default Device");
+ result.emplace_back(defaultDevice);
+
for (size_t i = 0; i < devices.count; ++i)
{
- //const auto& device = devices.device[i];
+ // const auto& device = devices.device[i];
if (devices.device[i].state == CUBEB_DEVICE_STATE_ENABLED)
{
auto device = std::make_shared<CubebDeviceDescription>(devices.device[i].devid, devices.device[i].device_id,
- boost::nowide::widen(
- devices.device[i].friendly_name));
+ boost::nowide::widen(
+ devices.device[i].friendly_name));
result.emplace_back(device);
}
}
diff --git a/src/audio/CubebInputAPI.cpp b/src/audio/CubebInputAPI.cpp
index de030fdc5..c0fa73f41 100644
--- a/src/audio/CubebInputAPI.cpp
+++ b/src/audio/CubebInputAPI.cpp
@@ -180,15 +180,20 @@ std::vector<IAudioInputAPI::DeviceDescriptionPtr> CubebInputAPI::GetDevices()
return {};
std::vector<DeviceDescriptionPtr> result;
- result.reserve(devices.count);
+ result.reserve(devices.count + 1); // Reserve space for the default device
+
+ // Add the default device to the list
+ auto defaultDevice = std::make_shared<CubebDeviceDescription>(nullptr, "default", L"Default Device");
+ result.emplace_back(defaultDevice);
+
for (size_t i = 0; i < devices.count; ++i)
{
- //const auto& device = devices.device[i];
+ // const auto& device = devices.device[i];
if (devices.device[i].state == CUBEB_DEVICE_STATE_ENABLED)
{
auto device = std::make_shared<CubebDeviceDescription>(devices.device[i].devid, devices.device[i].device_id,
- boost::nowide::widen(
- devices.device[i].friendly_name));
+ boost::nowide::widen(
+ devices.device[i].friendly_name));
result.emplace_back(device);
}
}