diff --git a/main.py b/main.py index 31da410..d5703fc 100644 --- a/main.py +++ b/main.py @@ -167,13 +167,18 @@ class MainWindow(QMainWindow): self.timer.stop() def move_playhead(self): - self.current_x += 1.5 # Geschwindigkeit des Playheads + if self.audio_data is None or self.audio_stream is None: + return + + # Berechne die aktuelle Position des Playheads basierend auf der Abspielposition + self.current_x = (self.playback_pos / len(self.audio_data)) * self.timeline_length if self.current_x <= self.timeline_length: self.playhead.setX(self.current_x) else: self.pause() self.current_x = 0.0 self.playhead.setX(self.current_x) + self.playback_pos = 0 def audio_callback(self, outdata, frames, time, status): if status: