fix:add exception in sound_controller.py

This commit is contained in:
Kylin_on_Mac 2023-11-17 11:48:42 +08:00
parent fff075d4b4
commit ac396cb58d
1 changed files with 4 additions and 1 deletions

View File

@ -1,3 +1,5 @@
import traceback
import pygame import pygame
from .env import * from .env import *
@ -28,8 +30,9 @@ class SoundController():
self._fail = pygame.mixer.Sound(path.join(SOUND_PATH, "fail.mp3")) self._fail = pygame.mixer.Sound(path.join(SOUND_PATH, "fail.mp3"))
self._lv_up = pygame.mixer.Sound(path.join(SOUND_PATH, "lv_up.mp3")) self._lv_up = pygame.mixer.Sound(path.join(SOUND_PATH, "lv_up.mp3"))
self._lv_down = pygame.mixer.Sound(path.join(SOUND_PATH, "lv_down.mp3")) self._lv_down = pygame.mixer.Sound(path.join(SOUND_PATH, "lv_down.mp3"))
except Exception: except Exception as e :
self._is_sound_on = False self._is_sound_on = False
traceback.print_exc()
@sound_enabled @sound_enabled
def play_music(self): def play_music(self):