SfxPlayers¶
from acron.audio import SfxPlayers
- class SfxPlayers(base, res=None, voices: int = 5, master: float = 1.0, loader=None)¶
Bases:
objectGodot game scripts’ polyphonic SFX pattern: a bank of
voicessibling one-shotAudioStreamPlayer``s where ``playuses the FIRST idle voice and a saturated bank DROPS the sound (that voice-limit behaviour is part of how the games sound – don’t “fix” it).Each voice owns its own AudioSound instance per clip, so one file can overlap up to
voicestimes (SoundBankkeeps ONE handle per uri and restarts it – monophonic by design).masterscales every play; games often bake a global factor (e.g. 0.75) and can live-update the attribute for a volume setting.Godot quirk, handled sanely rather than verbatim:
AudioStreamPlayerREJECTSpitch_scale <= 0and silently keeps the voice’s previous pitch, so upstream calls that pass0.0play at an arbitrary leftover pitch – here they play at 1.0.loaderdefaults tobase.loader; tests inject a stub.Inheritance diagram
digraph inheritance3b9eea8607 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "SfxPlayers" [URL="acron.audio.SfxPlayers.html#acron.audio.SfxPlayers",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="Godot game scripts' polyphonic SFX pattern: a bank of ``voices``"]; }