forked from nikita/muzika-gromche
Add configurable global audio offset, useful for Bluetooth headsets
This commit is contained in:
parent
b73c7ee3cb
commit
34d8da1562
|
@ -198,6 +198,8 @@ namespace MuzikaGromche
|
||||||
// [2] Start source has finished
|
// [2] Start source has finished
|
||||||
: loop.time + FixedLoopDelay;
|
: loop.time + FixedLoopDelay;
|
||||||
|
|
||||||
|
elapsed -= Config.AudioOffset.Value;
|
||||||
|
|
||||||
var normalized = Mod.Positive(elapsed / LoadedLoop.length, 1f);
|
var normalized = Mod.Positive(elapsed / LoadedLoop.length, 1f);
|
||||||
|
|
||||||
var beat = normalized * (float)Beats;
|
var beat = normalized * (float)Beats;
|
||||||
|
@ -346,10 +348,17 @@ namespace MuzikaGromche
|
||||||
|
|
||||||
public class Config : SyncedConfig2<Config>
|
public class Config : SyncedConfig2<Config>
|
||||||
{
|
{
|
||||||
|
public static ConfigEntry<float> AudioOffset { get; private set; }
|
||||||
|
|
||||||
public static bool ShouldSkipWindingPhase { get; private set; } = false;
|
public static bool ShouldSkipWindingPhase { get; private set; } = false;
|
||||||
|
|
||||||
public Config(ConfigFile configFile) : base(PluginInfo.PLUGIN_GUID)
|
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
|
#if DEBUG
|
||||||
SetupEntriesToSkipWinding(configFile);
|
SetupEntriesToSkipWinding(configFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue