From 1601206b57915326e2db7340094a9509682ed54f Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 26 Jun 2025 21:52:58 -0700 Subject: [PATCH] Playback: Redo seeking to stick with the open file Again, this is for the best anyway. Reopening the file repeatedly really was slow, and resulted in deadlocks with rapid fire seeking, especially with the Touch Bar scrubber control. Signed-off-by: Christopher Snowhill --- Audio/AudioPlayer.m | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Audio/AudioPlayer.m b/Audio/AudioPlayer.m index 8d4ef1acc..da34272c4 100644 --- a/Audio/AudioPlayer.m +++ b/Audio/AudioPlayer.m @@ -196,18 +196,28 @@ } - (void)seekToTime:(double)time { + [output fadeOutBackground]; + [output setVolume:volume]; + + [output seek:time]; + [bufferChain seek:time]; + CogStatus status = (CogStatus)currentPlaybackStatus; - NSURL *url; + BOOL paused = status == CogStatusPaused; id userInfo; - NSDictionary *rgi; @synchronized(chainQueue) { - url = [bufferChain streamURL]; userInfo = [bufferChain userInfo]; - rgi = [bufferChain rgInfo]; } - [self play:url withUserInfo:userInfo withRGInfo:rgi startPaused:(status == CogStatusPaused) andSeekTo:time andResumeInterval:YES]; + if(paused) { + [self setPlaybackStatus:CogStatusPaused waitUntilDone:YES]; + if(time > 0.0) { + [self updatePosition:userInfo]; + } + } else { + [output fadeIn]; + } } - (void)setVolume:(double)v {