audio: create a wrapper for asio drivers (#731)

## Link to GitHub Issue or related Pull Request, if one exists
n/a

## Description of change
Create `WrappedAsio`, similar to how we wrap `IAudioEndpoint`

So far, the wrapper does these things:

1. logging (for diagnosis, since iidx and gfdm don't produce any logs
when asio succeeds)
2. iidx32+ hack to work around refcount mismatch issue
3. sdvx valk cab hack to force 2-channel audio ("downmixing" by taking
only the front channels)
4. honor volume boost

As a result of `#2` the mempatch was removed from `iidx.cpp` since we
can tackle it cleanly in the hook. `#3` also removes the need for manual
patches.

Real downmixing is hard & expensive on the CPU so it was not
implemented.

## Testing
Tested iidx/sdvx/gfdm with xonar and flexasio
This commit is contained in:
bicarus
2026-06-04 09:24:44 -07:00
committed by GitHub
parent ea2f4c5572
commit 85058c2156
8 changed files with 998 additions and 33 deletions
+4
View File
@@ -72,6 +72,7 @@
#include "games/museca/museca.h"
#include "hooks/avshook.h"
#include "hooks/audio/audio.h"
#include "hooks/audio/asio_proxy.h"
#include "hooks/audio/backends/wasapi/downmix.h"
#include "hooks/debughook.h"
#include "hooks/devicehook.h"
@@ -496,6 +497,9 @@ int main_implementation(int argc, char *argv[]) {
if (options[launcher::Options::spice2x_SDVXAsioDriver].is_active()) {
games::sdvx::ASIO_DRIVER = options[launcher::Options::spice2x_SDVXAsioDriver].value_text();
}
if (options[launcher::Options::SDVXAsioTwoChannel].value_bool()) {
WrappedAsio::FORCE_TWO_CHANNELS = true;
}
if (options[launcher::Options::spice2x_SDVXSubPos].is_active()) {
auto txt = options[launcher::Options::spice2x_SDVXSubPos].value_text();
if (txt == "top") {
+10 -1
View File
@@ -948,6 +948,15 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
.category = "Game Options",
.picker = OptionPickerType::AsioDriver,
},
{
// SDVXAsioTwoChannel
.title = "SDVX ASIO Two Channel Audio",
.name = "sdvxasio2ch",
.desc = "Force the game to use two channels for ASIO output.",
.type = OptionType::Bool,
.game_name = "Sound Voltex",
.category = "Game Options",
},
{
// spice2x_SDVXSubPos
.title = "SDVX Subscreen Overlay Position",
@@ -1965,7 +1974,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
},
{
// VolumeBoost
.title = "WASAPI Boost Audio Volume",
.title = "WASAPI/ASIO Boost Audio Volume",
.name = "volumeboost",
.desc = "Artificially amplifies the hooked audio output by the selected amount, applied "
"right before the audio reaches the device. Works regardless of channel layout or "
+1
View File
@@ -94,6 +94,7 @@ namespace launcher {
spice2x_SDVXDigitalKnobSensitivity,
SDVXDigitalKnobSocd,
spice2x_SDVXAsioDriver,
SDVXAsioTwoChannel,
spice2x_SDVXSubPos,
SDVXSubMonitorOverride,
LoadDDRModule,