Adding the skills
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user