Source code for miniworldmaker.boards.board_manager.board_music_manager

from miniworldmaker.base import app as app_mod
from typing import Optional

[docs] class BoardMusicManager: def __init__(self, app: "app_mod.App"): "app_mod.App" = app self.music_manager =
[docs] def pause(self): """pauses a music """ self.music_manager.pause()
[docs] def is_playing(self) -> bool: """returns True, if board is playing a music (and music ist not paused) """ return self.music_manager.is_playing()
[docs] def get_path(self) -> str: """gets path to current music Returns: The path to current music file """ return self.music_manager.path()
[docs] def play(self, path: Optional[str] = None, loop = -1): """plays a music from path Args: path: The path to the music loop: Specifies how often the music must be repeated (-1: infinitely often) Returns: """ self.music_manager.play_music(path, loop)
[docs] def stop(self): """stops a music Returns: """ self.music_manager.stop_music()
[docs] def set_volume(self, volume: float): """sets volume of music Args: volume: Volume between 0 and 100 """ self.music_manager.set_volume(volume)
[docs] def get_volume(self) -> float: """gets volume of music Returns: current volume """ return self.music_manager.get_volume()