2024-08-28 15:10:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <mmreg.h>
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
#include <ks.h>
|
|
|
|
#include <ksmedia.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace hooks::audio {
|
|
|
|
enum class Backend {
|
|
|
|
Asio,
|
|
|
|
WaveOut,
|
2024-08-28 15:43:11 +00:00
|
|
|
Pipewire,
|
|
|
|
None
|
2024-08-28 15:10:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern bool ENABLED;
|
|
|
|
extern bool VOLUME_HOOK_ENABLED;
|
|
|
|
extern bool USE_DUMMY;
|
|
|
|
extern WAVEFORMATEXTENSIBLE FORMAT;
|
|
|
|
extern std::optional<Backend> BACKEND;
|
|
|
|
extern size_t ASIO_DRIVER_ID;
|
|
|
|
extern bool ASIO_FORCE_UNLOAD_ON_STOP;
|
|
|
|
extern bool LOW_LATENCY_SHARED_WASAPI;
|
|
|
|
|
|
|
|
void init();
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
inline std::optional<Backend> name_to_backend(const char *value) {
|
|
|
|
if (_stricmp(value, "asio") == 0) {
|
|
|
|
return Backend::Asio;
|
|
|
|
} else if (_stricmp(value, "waveout") == 0) {
|
|
|
|
return Backend::WaveOut;
|
2024-08-28 15:43:11 +00:00
|
|
|
} else if (_stricmp(value, "pipewire") == 0) {
|
|
|
|
return Backend::Pipewire;
|
2024-08-28 15:33:31 +00:00
|
|
|
} else if (_stricmp(value, "none") == 0) {
|
|
|
|
return Backend::None;
|
2024-08-28 15:10:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
}
|