Files
glitch_bloodsugar/skills/sound-bridge.md
T

35 lines
1.0 KiB
Markdown
Raw Normal View History

2026-04-01 22:36:42 +02:00
# Sound Bridge Notes
Glitch University uses a host-managed sound system (Howler-based) with string sound keys, for example:
- `playSound('ui.button_click')`
- `playSound('ui.button_hover')`
## Recommendation
Treat sound as an optional host integration:
- Use a small wrapper function in the component (`safePlaySound`) that checks whether a host sound function exists.
- No-op when unavailable (standalone dev should still run).
- Keep sound identifiers as strings/constants so they match host definitions.
## Example Pattern
```ts
type PlaySound = (id: string) => void;
export function safePlaySound(playSound: PlaySound | undefined, id: string) {
try {
playSound?.(id);
} catch {
// Ignore host sound errors in standalone/local mode
}
}
```
## Unknowns to Confirm Later
- How the host exposes `playSound` to glitch-components (prop, context, global import, event bus)
- Which sound keys are safe/standardized across experiences
- Whether completion/reward sounds are triggered by host or component