mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
audio: stereo downmix, volume boost options (#722)
## Link to GitHub Issue or related Pull Request, if one exists Fixes #717, fixes #647 ## Description of change Adds an option to downmix surround sound (5.1, 7.1, etc) down to stereo (2 speakers). This can be used in most WASAPI games, including Gitadora and FTT. How it works: when the game tries to open surround format (say, 7.1) we create a fake buffer and tell the game that it is supported. In reality we open a 2-channel stream with the real sound card. When the stream begins, we downmix the channels down to two (using one of many algorithms) and output to the sound card. While we're here, implement an option to boost the game volume by some decibel value, which is a feature often requested by SDVX players. This was needed since downmixing can sometimes result in quieter audio. ## Testing Tested GW Delta and FTT. Downmix doesn't work on IIDX (32 bits) but volume boost works.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <assert.h>
|
||||
#include <shlwapi.h>
|
||||
#include <windows.h>
|
||||
@@ -70,6 +72,7 @@
|
||||
#include "games/museca/museca.h"
|
||||
#include "hooks/avshook.h"
|
||||
#include "hooks/audio/audio.h"
|
||||
#include "hooks/audio/backends/wasapi/downmix.h"
|
||||
#include "hooks/debughook.h"
|
||||
#include "hooks/devicehook.h"
|
||||
#include "hooks/graphics/nvenc_hook.h"
|
||||
@@ -1092,6 +1095,17 @@ int main_implementation(int argc, char *argv[]) {
|
||||
if (options[launcher::Options::spice2x_DisableVolumeHook].value_bool()) {
|
||||
hooks::audio::VOLUME_HOOK_ENABLED = false;
|
||||
}
|
||||
if (options[launcher::Options::DownmixAudioToStereo].is_active()) {
|
||||
auto &name = options[launcher::Options::DownmixAudioToStereo].value_text();
|
||||
hooks::audio::DOWNMIX_ALGORITHM = hooks::audio::Downmix::name_to_algorithm(name.c_str());
|
||||
}
|
||||
if (options[launcher::Options::VolumeBoost].is_active()) {
|
||||
const double decibels = std::strtod(
|
||||
options[launcher::Options::VolumeBoost].value_text().c_str(), nullptr);
|
||||
if (decibels > 0.0) {
|
||||
hooks::audio::VOLUME_BOOST = (float) std::pow(10.0, decibels / 20.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (options[launcher::Options::AudioBackend].is_active()) {
|
||||
auto &name = options[launcher::Options::AudioBackend].value_text();
|
||||
|
||||
Reference in New Issue
Block a user