MCPcopy Create free account
hub / github.com/codecombat/codecombat / createVoiceOverCommand

Function createVoiceOverCommand

ozaria/engine/cinematic/SoundSystem.js:13–26  ·  view source on GitHub ↗
(dialogNode, speakerThangType)

Source from the content-addressed store, hash-verified

11// Returns a voice over command from list of audio files
12// Includes a way to stop audio playing if user skips ahead, or goes backwards.
13const createVoiceOverCommand = (dialogNode, speakerThangType) => {
14 const soundIdPromise = store.dispatch('voiceOver/preload', { dialogNode, speakerThangType })
15 const voiceOverPlayCommand = new SyncFunction(() =>
16 store.dispatch('voiceOver/playVoiceOver', soundIdPromise)
17 )
18
19 voiceOverPlayCommand.undoCommandFactory = () => {
20 return new SyncFunction(() => {
21 store.dispatch('audio/fadeTrack', { to: 0, track: 'voiceOver', duration: 100 })
22 })
23 }
24
25 return voiceOverPlayCommand
26}
27
28const standardizeSpeaker = (speaker) => {
29 speaker = speaker.replace(/cinematic-/, '')

Callers 1

parseDialogNodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected