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 <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-06-26 21:52:58 -07:00
parent 6655dd34ec
commit 1601206b57

View file

@ -196,18 +196,28 @@
} }
- (void)seekToTime:(double)time { - (void)seekToTime:(double)time {
[output fadeOutBackground];
[output setVolume:volume];
[output seek:time];
[bufferChain seek:time];
CogStatus status = (CogStatus)currentPlaybackStatus; CogStatus status = (CogStatus)currentPlaybackStatus;
NSURL *url; BOOL paused = status == CogStatusPaused;
id userInfo; id userInfo;
NSDictionary *rgi;
@synchronized(chainQueue) { @synchronized(chainQueue) {
url = [bufferChain streamURL];
userInfo = [bufferChain userInfo]; 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 { - (void)setVolume:(double)v {