mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-20 07:14:25 +02:00
Added missing sounds file from previous commit
This commit is contained in:
parent
a738199868
commit
d4fbdb409f
@ -1,6 +1,27 @@
|
||||
import os
|
||||
import warnings
|
||||
|
||||
class DummySound:
|
||||
@staticmethod
|
||||
def play_start_sound(): pass
|
||||
@staticmethod
|
||||
def play_cymais_intro_sound(): pass
|
||||
@staticmethod
|
||||
def play_finished_successfully_sound(): pass
|
||||
@staticmethod
|
||||
def play_finished_failed_sound(): pass
|
||||
@staticmethod
|
||||
def play_warning_sound(): pass
|
||||
|
||||
_IN_DOCKER = os.path.exists('/.dockerenv')
|
||||
|
||||
if _IN_DOCKER:
|
||||
warnings.warn("Sound support disabled: running inside Docker.", RuntimeWarning)
|
||||
Sound = DummySound
|
||||
else:
|
||||
try:
|
||||
import numpy as np
|
||||
import simpleaudio as sa
|
||||
|
||||
class Sound:
|
||||
"""
|
||||
Sound effects for the application with enhanced complexity.
|
||||
@ -122,3 +143,6 @@ class Sound:
|
||||
durations = [d * cls.max_length / total for d in durations]
|
||||
waves = [cls._generate_complex_wave(f, d) for f, d in zip(freqs, durations)]
|
||||
cls._play(np.concatenate(waves))
|
||||
except Exception:
|
||||
warnings.warn("Sound support disabled: numpy or simpleaudio could not be imported", RuntimeWarning)
|
||||
Sound = DummySound
|
||||
|
Loading…
x
Reference in New Issue
Block a user