fix: Sound Voltex 6 pipewire support

> should resolve `-audiobackend` incompatibilities, see #9
This commit is contained in:
[ ]
2026-01-16 03:32:44 +09:00
parent 244f4aa56a
commit 1cb5b7b52a
+12 -8
View File
@@ -94,7 +94,7 @@ HRESULT PipewireBackend::on_initialize(AUDCLNT_SHAREMODE *ShareMode, DWORD *Stre
log_info("audio::pipewire", "{}", __FUNCTION__);
// Initialize pipewire client (without starting the thread)
client_ = BmswClientCreate(GAME_INSTANCE->title(), nullptr, nullptr);//(void *)callback_notify,this
client_ = BmswClientCreate(GAME_INSTANCE->title(), nullptr, nullptr);
notif_ = std::thread(PipewireBackend::notif_poll, this);
if (!client_)
@@ -116,9 +116,12 @@ HRESULT PipewireBackend::on_initialize(AUDCLNT_SHAREMODE *ShareMode, DWORD *Stre
HRESULT PipewireBackend::on_set_event_handle(HANDLE *event_handle)
{
log_info("audio::pipewire", "{}", __FUNCTION__);
this->relay_handle_ = *event_handle; // take over WASAPI's owned handle pre-initialized by client
//BmswClientUpdateCallback(client_, (void *) 0, this->relay_handle_);
*event_handle = CreateEvent(nullptr, true, false, nullptr); // replace WASAPI's handle with always off handle
// Take over WASAPI's owned handle pre-initialized by client and replace with always off dummy, cleaning up previously owned handle
if (relay_handle_) CloseHandle(relay_handle_);
relay_handle_ = *event_handle;
*event_handle = CreateEvent(nullptr, true, false, nullptr);
//BmswClientUpdateCallback(client_, (void *) 0, relay_handle_);
return S_OK;
@@ -137,7 +140,7 @@ HRESULT PipewireBackend::on_start() noexcept
BmswClientStart(client_);
return S_OK;
}
PipewireBackend::PipewireBackend() : relay_handle_(nullptr), format_(hooks::audio::FORMAT), client_(nullptr), notif_state_(-1)
PipewireBackend::PipewireBackend() : relay_handle_(CreateEvent(nullptr, true, false, nullptr)), format_(hooks::audio::FORMAT), client_(nullptr), notif_state_(-1)
{
log_info("audio::pipewire", "{}", __FUNCTION__);
@@ -183,7 +186,7 @@ inline static void callback_notify(void *self)
{
DWORD last_error = GetLastError();
log_warning("audio::pipewire", "SetEvent failed: {} ({})",
log_warning("audio::pipewire", "SetEvent failed({}): {}",
last_error,
std::system_category().message(last_error));
}
@@ -267,6 +270,7 @@ PipewireBackend::~PipewireBackend()
}
}
if (client_) BmswClientDestroy(client_);
if (relay_handle_) CloseHandle(relay_handle_);
}
/* Unsorted (unknown callers, should be considered as unimplemented/untested) *///_BUG: does this need implementation?
@@ -277,14 +281,14 @@ const WAVEFORMATEXTENSIBLE &PipewireBackend::format() const noexcept
}
HRESULT PipewireBackend::on_get_stream_latency(REFERENCE_TIME *latency) noexcept
{
log_info("audio::pipewire", "{}", __FUNCTION__);
// log_info("audio::pipewire", "{}", __FUNCTION__);
*latency = BmswClientFormatPeriodWRT(client_);
return S_OK;
}
HRESULT PipewireBackend::on_get_current_padding(std::optional<uint32_t> &padding_frames) noexcept
{
log_info("audio::pipewire", "{}", __FUNCTION__);
// log_info("audio::pipewire", "{}", __FUNCTION__);
padding_frames = 0;
return S_OK;