feat(sfx): play paint_apply sound when a material is painted

Registers a paintApply SFX (with rate/volume jitter + a 60ms gap so rapid
multi-face painting doesn't machine-gun), wires the sfx:paint-apply bus
event, and emits it from the material-paint click chokepoint in the
selection manager (fires on apply, not hover/preview). Adds the audio
asset to the editor app's public resources.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-06-19 10:50:48 -04:00
co-authored by Claude Opus 4.8
parent ee4d6de206
commit bf9246cd36
4 changed files with 12 additions and 0 deletions
@@ -1157,6 +1157,7 @@ export const SelectionManager = () => {
}
interaction.apply()
sfxEmitter.emit('sfx:paint-apply')
if (activePreview?.key === interaction.key) {
activePreview = null
} else {
+2
View File
@@ -16,6 +16,7 @@ type SFXEvents = {
'sfx:snapshot-capture': undefined
'sfx:menu-hover': undefined
'sfx:menu-click': undefined
'sfx:paint-apply': undefined
}
/**
@@ -45,6 +46,7 @@ export function initSFXBus() {
sfxEmitter.on('sfx:snapshot-capture', () => playSFX('snapshotCapture'))
sfxEmitter.on('sfx:menu-hover', () => playSFX('menuHover'))
sfxEmitter.on('sfx:menu-click', () => playSFX('menuClick'))
sfxEmitter.on('sfx:paint-apply', () => playSFX('paintApply'))
}
/**
+9
View File
@@ -100,6 +100,15 @@ export const SFX: Record<string, SFXConfig> = {
volumeRange: [0.5, 0.6],
panJitter: 0.1,
},
// Fired when a material is applied to a surface in paint mode. Painting can
// fire in quick succession across faces, so keep variation + a small gap.
paintApply: {
src: '/audios/sfx/paint_apply.mp3',
rateRange: [0.95, 1.05],
volumeRange: [0.85, 1.0],
panJitter: 0.12,
minIntervalMs: 60,
},
} as const
export type SFXName = keyof typeof SFX