| 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. |
| 13 | const 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 | |
| 28 | const standardizeSpeaker = (speaker) => { |
| 29 | speaker = speaker.replace(/cinematic-/, '') |