ObjSound manages and provides access to sound files indexed in sounds.yaml. It provides a centralized system for managing audio resources used throughout the Axion platform.
Module: factory.core/ObjSound.py
Inherits from: Objects.Object
Configuration: factory.core/sounds.yaml
The module loads sound definitions from factory.core/sounds.yaml:
sounds:
notification:
path: "sounds/notification.mp3"
description: "Notification sound"
alert:
path: "sounds/alert.wav"
description: "Alert sound"
__init__(db_connection=0)Initializes the ObjSound object and loads the sound index from sounds.yaml.
_load_sound_index()Loads the sounds.yaml file and populates the _sound_index dictionary.
Process:
get_sound(sound_key: str) -> Optional[Dict]Retrieves sound information by key.
Parameters:
sound_key: The key/name of the soundReturns:
get_sound_path(sound_key: str) -> Optional[str]Gets the file path for a sound.
Parameters:
sound_key: The key/name of the soundReturns:
list_sounds() -> List[str]Lists all available sound keys.
Returns:
###Basic Sound Retrieval
from ObjSound import ObjSound
# Create instance
sounds = ObjSound()
# Get sound information
notification = sounds.get_sound("notification")
print(notification) # {'path': 'sounds/notification.mp3', 'description': '...'}
# Get sound file path
path = sounds.get_sound_path("alert")
print(path) # /full/path/to/sounds/alert.wav
# List all sounds
all_sounds = sounds.list_sounds()
print(all_sounds) # ['notification', 'alert', ...]
yaml - YAML configuration parsingObjects - Base object classObjMedia.py - Media file handlingObjNotify.py - Notifications that may use sounds