feat: integrate authored nightdrive soundtrack
This commit is contained in:
26
src/audio/journey-music-state.ts
Normal file
26
src/audio/journey-music-state.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { AudioJourneyState } from '@/audio/types';
|
||||
|
||||
const JOURNEY_MUSIC = Object.freeze({
|
||||
start: { bias: 'open', entryPhrase: 0 },
|
||||
profile: { bias: 'open', entryPhrase: 1 },
|
||||
experience: { bias: 'shadow', entryPhrase: 2 },
|
||||
infrastructure: { bias: 'shadow', entryPhrase: 3 },
|
||||
'selected-builds': { bias: 'lift', entryPhrase: 4 },
|
||||
'additional-work': { bias: 'lift', entryPhrase: 5 },
|
||||
toolkit: { bias: 'resolve', entryPhrase: 6 },
|
||||
contact: { bias: 'resolve', entryPhrase: 7 },
|
||||
} as const);
|
||||
|
||||
export function resolveJourneyMusicState(sectionId: string, intensity = 0): AudioJourneyState {
|
||||
const chapter = Object.hasOwn(JOURNEY_MUSIC, sectionId)
|
||||
? JOURNEY_MUSIC[sectionId as keyof typeof JOURNEY_MUSIC]
|
||||
: JOURNEY_MUSIC.start;
|
||||
const finiteIntensity = Number.isFinite(intensity) ? intensity : 0;
|
||||
return Object.freeze({
|
||||
...chapter,
|
||||
atStart: sectionId === 'start',
|
||||
intensity: Math.min(1, Math.max(0, finiteIntensity)),
|
||||
});
|
||||
}
|
||||
|
||||
export const DEFAULT_AUDIO_JOURNEY_STATE = resolveJourneyMusicState('start');
|
||||
Reference in New Issue
Block a user