@@ -53,6 +53,7 @@ export interface ProjectEditorState {
5353 backgroundMusicRegions : TrimRegion [ ] ;
5454 backgroundMusicVolume : number ;
5555 audioHooks : AudioHooksConfig ;
56+ hookSoundLayers : Record < AudioHookType , string [ ] > ;
5657 audioHooksVolume : number ;
5758 shadowIntensity : number ;
5859 showBlur : boolean ;
@@ -137,6 +138,41 @@ function normalizeAudioHooks(value: unknown): AudioHooksConfig {
137138 } ;
138139}
139140
141+ function normalizeHookSoundLayers ( value : unknown ) : Record < AudioHookType , string [ ] > {
142+ const defaults : Record < AudioHookType , string [ ] > = {
143+ zoom : [ ] ,
144+ trim : [ ] ,
145+ speed : [ ] ,
146+ annotation : [ ] ,
147+ blur : [ ] ,
148+ } ;
149+
150+ if ( ! value || typeof value !== "object" ) {
151+ return defaults ;
152+ }
153+
154+ const raw = value as Partial < Record < AudioHookType , unknown > > ;
155+ return {
156+ zoom : Array . isArray ( raw . zoom )
157+ ? raw . zoom . filter ( ( entry ) : entry is string => typeof entry === "string" && entry . length > 0 )
158+ : [ ] ,
159+ trim : Array . isArray ( raw . trim )
160+ ? raw . trim . filter ( ( entry ) : entry is string => typeof entry === "string" && entry . length > 0 )
161+ : [ ] ,
162+ speed : Array . isArray ( raw . speed )
163+ ? raw . speed . filter ( ( entry ) : entry is string => typeof entry === "string" && entry . length > 0 )
164+ : [ ] ,
165+ annotation : Array . isArray ( raw . annotation )
166+ ? raw . annotation . filter (
167+ ( entry ) : entry is string => typeof entry === "string" && entry . length > 0 ,
168+ )
169+ : [ ] ,
170+ blur : Array . isArray ( raw . blur )
171+ ? raw . blur . filter ( ( entry ) : entry is string => typeof entry === "string" && entry . length > 0 )
172+ : [ ] ,
173+ } ;
174+ }
175+
140176function isFileUrl ( value : string ) : boolean {
141177 return / ^ f i l e : \/ \/ / i. test ( value ) ;
142178}
@@ -513,6 +549,9 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
513549 ? clamp ( ( editor as { backgroundMusicVolume : number } ) . backgroundMusicVolume , 0 , 1 )
514550 : 0.35 ,
515551 audioHooks : normalizeAudioHooks ( ( editor as { audioHooks ?: unknown } ) . audioHooks ) ,
552+ hookSoundLayers : normalizeHookSoundLayers (
553+ ( editor as { hookSoundLayers ?: unknown } ) . hookSoundLayers ,
554+ ) ,
516555 audioHooksVolume : isFiniteNumber ( ( editor as { audioHooksVolume ?: unknown } ) . audioHooksVolume )
517556 ? clamp ( ( editor as { audioHooksVolume : number } ) . audioHooksVolume , 0 , 1 )
518557 : 0.35 ,
0 commit comments