Sync playback to the actual beat count rather than relying on BPM #5

Open
ratijas wants to merge 43 commits from ratijas/muzika-gromche:work/r/beats into master
1 changed files with 9 additions and 0 deletions
Showing only changes of commit 34d8da1562 - Show all commits

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