Skip to content

Prevent one-shot sound stacking on retriggered presses - #67

Merged
vanlueckn merged 1 commit into
mainfrom
t3code/cab-input-sound-stacking
Aug 20, 2026
Merged

Prevent one-shot sound stacking on retriggered presses#67
vanlueckn merged 1 commit into
mainfrom
t3code/cab-input-sound-stacking

Conversation

@vanlueckn

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes sound stacking when a cab control is pressed repeatedly without releasing
  • When a one-shot retriggered, the old voice is now faded out over 15ms instead of stopping abruptly
  • Reduces loudness buildup from repeated key presses (e.g. ten presses ≠ ten times the level)
  • Introduces STEAL tween constant for retriggered one-shot fadeout
  • Stores last played handle per source in Audio::shots HashMap to enable voice replacement

Testing

  • Rapid repeated presses of any cab control (button, switch, lever) that triggers one-shots — verify no volume accumulation
  • Single press of a control — verify no audible change to timing or quality
  • Audio output with rapid manual retriggering in simulator — confirm smooth continuity without clicks or pops

- Stop the previous one-shot of the same source when it is retriggered
- Fade it out over 15ms (STEAL tween) to avoid clicks
- Tracks active one-shots per (train, vehicle, file) in Audio::shots HashMap
@vanlueckn
vanlueckn merged commit e49fed0 into main Aug 20, 2026
3 checks passed
@vanlueckn
vanlueckn deleted the t3code/cab-input-sound-stacking branch August 20, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant