From b59cb1d3b0d8433a17cc1a58342dd92947b3e7fc Mon Sep 17 00:00:00 2001 From: JayDiddyThaGOAT Date: Wed, 24 May 2023 12:30:58 -0400 Subject: [PATCH 1/2] Fix bug with song previewing at wrong time --- Assets/Script/Audio/Bass/BassPreviewContext.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Script/Audio/Bass/BassPreviewContext.cs b/Assets/Script/Audio/Bass/BassPreviewContext.cs index 9c4c96054..01b76308c 100644 --- a/Assets/Script/Audio/Bass/BassPreviewContext.cs +++ b/Assets/Script/Audio/Bass/BassPreviewContext.cs @@ -116,11 +116,11 @@ await UniTask.RunOnThreadPool(() => { } // Set preview start and end times - PreviewStartTime = song.PreviewStartTimeSpan.TotalSeconds; + PreviewStartTime = _songToLoad.PreviewStartTimeSpan.TotalSeconds; if (PreviewStartTime <= 0.0) { PreviewStartTime = 10.0; } - PreviewEndTime = song.PreviewEndTimeSpan.TotalSeconds; + PreviewEndTime = _songToLoad.PreviewEndTimeSpan.TotalSeconds; if (PreviewEndTime <= 0.0) { PreviewEndTime = PreviewStartTime + Constants.PREVIEW_DURATION; } From 83e9126cedf07ae019fb126a2e3bb3d24bba99ef Mon Sep 17 00:00:00 2001 From: JayDiddyThaGOAT Date: Wed, 24 May 2023 12:31:21 -0400 Subject: [PATCH 2/2] Fixed potential bug where song to load could set to null --- Assets/Script/Audio/Bass/BassPreviewContext.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Script/Audio/Bass/BassPreviewContext.cs b/Assets/Script/Audio/Bass/BassPreviewContext.cs index 01b76308c..7405177c4 100644 --- a/Assets/Script/Audio/Bass/BassPreviewContext.cs +++ b/Assets/Script/Audio/Bass/BassPreviewContext.cs @@ -60,13 +60,13 @@ await UniTask.WaitUntil(() => } public async UniTask PlayPreview(SongEntry song) { - _songToLoad = song; - // Skip if preview shouldn't be played if (song == null || Mathf.Approximately(SettingsManager.Settings.PreviewVolume.Data, 0f)) { return; } + _songToLoad = song; + // If a preview is being loaded, WE DON'T want to mess with that process if (_loadingPreview) { if (!_loadCanceller?.IsCancellationRequested ?? false) {