Phase 2: audio mirror via WASAPI process loopback
Mirror the real game's audio so Steam Remote Play Together (which streams the host's own audio session) carries it to the guest. The host captures the game by PID via WASAPI process loopback and re-renders it on the default endpoint; the game still plays locally too (accepted "double audio" for now). - ProcessLoopbackCapture: process-loopback capture client, frame-sink + stats. The completion handler must be agile (IAgileObject) or ActivateAudioInterfaceAsync rejects every call with E_ILLEGAL_METHOD_CALL. - AudioMirror: wraps capture with an event-driven render client and a primed ring buffer; AudioPanel drives it from the injected game's window/PID. - coop_tone: standalone WASAPI sine-wave process used as a known audio source. - audio_loopback_test (CTest): captures coop_tone by PID and asserts non-silent audio arrives, so the path is verifiable without a second Steam account. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
30
host/src/audio_panel.hpp
Normal file
30
host/src/audio_panel.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// Owns the audio-mirror pipeline (WASAPI process loopback + re-render) and its
|
||||
// UI. The target process is derived from the injected game's window.
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "audio/audio_loopback.hpp"
|
||||
|
||||
namespace coop
|
||||
{
|
||||
|
||||
class AudioPanel
|
||||
{
|
||||
public:
|
||||
// The window whose process audio to mirror (0 if none); typically the
|
||||
// injected game's HWND.
|
||||
void set_target(HWND target)
|
||||
{
|
||||
target_ = target;
|
||||
}
|
||||
|
||||
void draw_ui();
|
||||
|
||||
private:
|
||||
HWND target_ = nullptr;
|
||||
bool enabled_ = false;
|
||||
AudioMirror mirror_;
|
||||
};
|
||||
|
||||
} // namespace coop
|
||||
Reference in New Issue
Block a user