Fix crash for playing audio

pygame 2.1.2 (SDL 2.24.0, Python 3.10.7
  File "audio_player.py", line 122, in _set_max_progress_bar
    self._audio_progress.setMaximum(
TypeError: setMaximum(self, int): argument 1 has unexpected type 'float'
This commit is contained in:
Jiří Pinkava
2022-09-27 23:39:24 +02:00
parent c84b0d2963
commit 490d9cf3e6

View File

@@ -1,3 +1,4 @@
import math
import os
from pygame import mixer
from PyQt5.QtCore import QTimer, pyqtSlot, QObject
@@ -120,7 +121,7 @@ class AudioPlayer(QObject):
def _set_max_progress_bar(self):
"""Set the maximum value of the progress bar."""
self._audio_progress.setMaximum(
mixer.Sound(self._audio_file).get_length() * 1000
math.ceil(mixer.Sound(self._audio_file).get_length() * 1000)
)
def set_audio_player(self, fname=""):