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:
@@ -1,3 +1,4 @@
|
|||||||
|
import math
|
||||||
import os
|
import os
|
||||||
from pygame import mixer
|
from pygame import mixer
|
||||||
from PyQt5.QtCore import QTimer, pyqtSlot, QObject
|
from PyQt5.QtCore import QTimer, pyqtSlot, QObject
|
||||||
@@ -120,7 +121,7 @@ class AudioPlayer(QObject):
|
|||||||
def _set_max_progress_bar(self):
|
def _set_max_progress_bar(self):
|
||||||
"""Set the maximum value of the progress bar."""
|
"""Set the maximum value of the progress bar."""
|
||||||
self._audio_progress.setMaximum(
|
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=""):
|
def set_audio_player(self, fname=""):
|
||||||
|
|||||||
Reference in New Issue
Block a user