Try to eliminate occasional short pause at start of track

Made playing the track the last thing in play_next()
This commit is contained in:
Keith Edmunds 2024-01-14 15:11:38 +00:00
parent 128fe2925f
commit b0278b92b0

View File

@ -1122,6 +1122,18 @@ class Window(QMainWindow, Ui_MainWindow):
if not track_sequence.now.path: if not track_sequence.now.path:
log.error("No path for next track") log.error("No path for next track")
return return
# Notify model
self.active_proxy_model().current_track_started()
# Note that track is now playing
self.playing = True
# Disable play next controls
self.disable_play_next_controls()
# Update headers
self.update_headers()
track_sequence.now.start() track_sequence.now.start()
self.music.play(track_sequence.now.path, position) self.music.play(track_sequence.now.path, position)
@ -1135,21 +1147,25 @@ class Window(QMainWindow, Ui_MainWindow):
volume = self.music.player.audio_get_volume() volume = self.music.player.audio_get_volume()
if volume < Config.VOLUME_VLC_DEFAULT: if volume < Config.VOLUME_VLC_DEFAULT:
self.music.set_volume() self.music.set_volume()
log.warning(f"Reset from {volume=}") log.debug(f"Reset from {volume=}")
break break
sleep(0.1) sleep(0.1)
# Notify model # Try making playing the last thing we do here to see whether
self.active_proxy_model().current_track_started() # the occasional short pause at the start of the track can be
# eliminated.
# Note that track is now playing # # Notify model
self.playing = True # self.active_proxy_model().current_track_started()
# Disable play next controls # # Note that track is now playing
self.disable_play_next_controls() # self.playing = True
# Update headers # # Disable play next controls
self.update_headers() # self.disable_play_next_controls()
# # Update headers
# self.update_headers()
def preview(self) -> None: def preview(self) -> None:
""" """