Merge pull request #34 from pinkavaj/pi-fix-play
Fix crash for playing audio
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