Add configurable global audio offset, useful for Bluetooth headsets

This commit is contained in:
ivan tkachenko 2025-07-14 17:08:44 +03:00
parent b73c7ee3cb
commit 34d8da1562
1 changed files with 9 additions and 0 deletions

View File

@ -198,6 +198,8 @@ namespace MuzikaGromche
// [2] Start source has finished
: loop.time + FixedLoopDelay;
elapsed -= Config.AudioOffset.Value;
var normalized = Mod.Positive(elapsed / LoadedLoop.length, 1f);
var beat = normalized * (float)Beats;
@ -346,10 +348,17 @@ namespace MuzikaGromche
public class Config : SyncedConfig2<Config>
{
public static ConfigEntry<float> AudioOffset { get; private set; }
public static bool ShouldSkipWindingPhase { get; private set; } = false;
public Config(ConfigFile configFile) : base(PluginInfo.PLUGIN_GUID)
{
AudioOffset = configFile.Bind("General", "Audio Offset", 0f, new ConfigDescription(
"Adjust audio offset (in seconds).\n\nIf you are playing with Bluetooth headphones and experiencing a visual desync, try setting this to about negative 0.2.\n\nIf your video output has high latency (like a long HDMI cable etc.), try positive values instead.",
new AcceptableValueRange<float>(-0.5f, 0.5f)));
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(AudioOffset, requiresRestart: false));
#if DEBUG
SetupEntriesToSkipWinding(configFile);
#endif