diff --git a/assets/sunshine.conf b/assets/sunshine.conf index 6dd5cecf..78f31b2d 100644 --- a/assets/sunshine.conf +++ b/assets/sunshine.conf @@ -84,7 +84,11 @@ # # !! Windows only !! # tools\audio-info.exe -# audio_sink = {0.0.0.00000000}.{FD47D9CC-4218-4135-9CE2-0C195C87405B} +# audio_sink = {0.0.0.00000000}.{FD47D9CC-4218-4135-9CE2-0C195C87405B} +# +# The virtual sink, is the audio device that's virtual (Like Steam Streaming Speakers), it allows Sunshine +# to stream audio, while muting the speakers. +# virtual_sink = {0.0.0.00000000}.{8edba70c-1125-467c-b89c-15da389bc1d4} # !! Windows only !! # You can select the video card you want to stream: diff --git a/sunshine/config.h b/sunshine/config.h index 3bced756..1b62818e 100644 --- a/sunshine/config.h +++ b/sunshine/config.h @@ -39,6 +39,7 @@ struct video_t { struct audio_t { std::string sink; + std::string virtual_sink; }; struct stream_t { diff --git a/sunshine/platform/common.h b/sunshine/platform/common.h index 978182f9..91fe185b 100644 --- a/sunshine/platform/common.h +++ b/sunshine/platform/common.h @@ -214,7 +214,6 @@ std::string from_sockaddr(const sockaddr *const); std::pair from_sockaddr_ex(const sockaddr *const); std::unique_ptr audio_control(); -std::unique_ptr microphone(std::uint32_t sample_rate, std::uint32_t frame_size); std::shared_ptr display(dev_type_e hwdevice_type); input_t input(); diff --git a/sunshine/platform/windows/audio.cpp b/sunshine/platform/windows/audio.cpp index b054aa27..1dc82016 100644 --- a/sunshine/platform/windows/audio.cpp +++ b/sunshine/platform/windows/audio.cpp @@ -259,10 +259,10 @@ const wchar_t *no_null(const wchar_t *str) { return str ? str : L"Unknown"; } -format_t::type_e validate_device(device_t &device) { +format_t::type_e validate_device(device_t &device, int sample_rate) { for(const auto &format : formats) { // Ensure WaveFromat is compatible - auto audio_client = make_audio_client(device, format, SAMPLE_RATE); + auto audio_client = make_audio_client(device, format, sample_rate); BOOST_LOG(debug) << format.name << ": "sv << !audio_client ? "unsupported"sv : "supported"sv; @@ -550,13 +550,13 @@ public: UINT count; collection->GetCount(&count); - std::string virtual_device_id; + std::string virtual_device_id = config::audio.virtual_sink; BOOST_LOG(debug) << "====== Found "sv << count << " potential audio devices ======"sv; for(auto x = 0; x < count; ++x) { audio::device_t device; collection->Item(x, &device); - auto type = validate_device(device); + auto type = validate_device(device, SAMPLE_RATE); if(type == format_t::none) { continue; }