#pragma once #include #include #include #include #include #ifndef _MSC_VER #include #include #endif namespace hooks::audio { enum class Backend { Asio, WaveOut, }; // surround-to-stereo downmix algorithm enum class DownmixAlgorithm { FrontOnly, // keep only the front channels RearOnly, // keep only the rear/back channels SideOnly, // keep only the side channels AC4, // AC-4 stereo downmix coefficients (ETSI TS 103 190-1) Normalize, // all channels equally loud, LFE dropped }; extern bool ENABLED; extern bool VOLUME_HOOK_ENABLED; extern std::optional DOWNMIX_ALGORITHM; extern float VOLUME_BOOST; // target sample rate the hooked output is resampled to, if set extern std::optional RESAMPLE_RATE; // minimum WASAPI exclusive buffer duration (milliseconds), if set. enlarges the device buffer // to avoid underrun crackle on endpoints that cannot service a tiny buffer in time. extern std::optional EXCLUSIVE_BUFFER_MS; extern bool USE_DUMMY; extern WAVEFORMATEXTENSIBLE FORMAT; extern std::optional BACKEND; extern std::optional ASIO_DRIVER_ID; extern std::string ASIO_DRIVER_NAME; extern bool ASIO_FORCE_UNLOAD_ON_STOP; extern bool LOW_LATENCY_SHARED_WASAPI; void init(); void stop(); inline std::optional name_to_backend(const char *value) { if (_stricmp(value, "asio") == 0) { return Backend::Asio; } else if (_stricmp(value, "waveout") == 0) { return Backend::WaveOut; } return std::nullopt; } }