Add emit reverse option and retune echo/dice output

This commit is contained in:
Jage9
2026-02-22 01:57:52 -05:00
parent c162e6dc3c
commit 93bb778cd7
12 changed files with 92 additions and 19 deletions

View File

@@ -19,6 +19,7 @@ EDITABLE_PROPERTIES: tuple[str, ...] = (
"emitVolume",
"emitSoundSpeed",
"emitSoundTempo",
"emitSoundReverse",
"emitEffect",
"emitEffectValue",
"useSound",
@@ -39,6 +40,7 @@ DEFAULT_PARAMS: dict = {
"emitVolume": 100,
"emitSoundSpeed": 50,
"emitSoundTempo": 50,
"emitSoundReverse": False,
"emitEffect": "off",
"emitEffectValue": 50,
"useSound": "",
@@ -75,6 +77,10 @@ PROPERTY_METADATA: dict[str, dict[str, object]] = {
"tooltip": "Playback tempo percent for emitted sound. 50 is normal, 0 is half, 100 is double. Using speed and tempo together may sound weird.",
"range": {"min": 0, "max": 100, "step": 1},
},
"emitSoundReverse": {
"valueType": "boolean",
"tooltip": "Play emitted sound in reverse.",
},
"emitEffect": {"valueType": "list", "tooltip": "Effect applied to emitted sound."},
"emitEffectValue": {
"valueType": "number",
@@ -154,6 +160,12 @@ def validate_update(item: WorldItem, next_params: dict) -> dict:
raise ValueError("emitSoundTempo must be between 0 and 100.")
next_params["emitSoundTempo"] = emit_tempo
emit_reverse = parse_bool_like(
next_params.get("emitSoundReverse", item.params.get("emitSoundReverse", False)),
default=False,
)
next_params["emitSoundReverse"] = emit_reverse
emit_effect = str(next_params.get("emitEffect", item.params.get("emitEffect", "off"))).strip().lower()
if emit_effect not in EFFECT_OPTIONS:
raise ValueError("emitEffect must be one of reverb, echo, flanger, high_pass, low_pass, off.")