diff --git a/friture/imageplot.py b/friture/imageplot.py index 87c862c4..cd696881 100644 --- a/friture/imageplot.py +++ b/friture/imageplot.py @@ -90,6 +90,7 @@ def pause(self): def restart(self): self.isPlaying = True + self.last_time = self.audiobackend.get_stream_time() self.timer.restart() def draw(self, painter, xMap, yMap, rect): diff --git a/friture/spectrogram_image.py b/friture/spectrogram_image.py index 1bb1777f..ac45000a 100644 --- a/friture/spectrogram_image.py +++ b/friture/spectrogram_image.py @@ -61,9 +61,10 @@ def erase(self): # resize the pixmap and update the offsets accordingly def resize(self, width, height): oldWidth = self.pixmap.width() / 2 - self.offset = (self.offset % oldWidth) * width / oldWidth - 1 # -1 to avoid black vertical lines on resize - self.offset = self.offset % width # to handle negative values - self.time_offset = (self.time_offset % oldWidth) * width / oldWidth + if width != oldWidth: + self.offset = (self.offset % oldWidth) * width / oldWidth + self.offset = self.offset % width # to handle negative values + self.time_offset = (self.time_offset % oldWidth) * width / oldWidth self.pixmap = self.pixmap.scaled(2 * width, height, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation) def setcanvas_height(self, canvas_height):