WIP system for cutting voice tracks with UI
This commit is contained in:
@@ -988,12 +988,12 @@
|
||||
|
||||
(dictSet interp.globals "Read" hollywoo.Movie.PlayMode.Read)
|
||||
(dictSet interp.globals "Watch" hollywoo.Movie.PlayMode.Watch)
|
||||
|
||||
($>d dictSet $>g interp.globals "Morning" Morning)
|
||||
($d $g "Day" Day)
|
||||
($d $g "Evening" Evening)
|
||||
($d $g "Night" Night)
|
||||
($d $g "LitNoSky" LitNoSky)
|
||||
($d $g "MatchVoiceTracks" hollywoo_flixel.MatchVoiceTracks)
|
||||
|
||||
(localVar colorObj (object))
|
||||
(doFor =>name color FlxColor.colorLookup
|
||||
|
||||
11
src/hollywoo_flixel/MatchVoiceTracks.hx
Normal file
11
src/hollywoo_flixel/MatchVoiceTracks.hx
Normal file
@@ -0,0 +1,11 @@
|
||||
package hollywoo_flixel;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
using StringTools;
|
||||
|
||||
import flixel.sound.FlxSound;
|
||||
import kiss_flixel.SimpleWindow;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class MatchVoiceTracks {}
|
||||
45
src/hollywoo_flixel/MatchVoiceTracks.kiss
Normal file
45
src/hollywoo_flixel/MatchVoiceTracks.kiss
Normal file
@@ -0,0 +1,45 @@
|
||||
@:keep
|
||||
(function matchVoiceTracks [:String fountainFile :Array<String> characterNames :String transcribeOutputJsonFile :String wavFile]
|
||||
(let [fountainLines (.split (sys.io.File.getContent fountainFile) "\n")
|
||||
speechWanted []
|
||||
:haxe.DynamicAccess<Dynamic> transcribeJson (haxe.Json.parse (sys.io.File.getContent transcribeOutputJsonFile))
|
||||
speechWantedWindow (SimpleWindow.create (object
|
||||
title "Lines needed"))
|
||||
sound (new FlxSound)]
|
||||
(sound.loadEmbedded wavFile)
|
||||
(doFor [&mut i :String line] (enumerate fountainLines)
|
||||
(doFor name characterNames
|
||||
(when (line.startsWith (name.toUpperCase))
|
||||
++i
|
||||
(while $>line (nth fountainLines i)
|
||||
(unless (.startsWith $line "(")
|
||||
(speechWanted.push $line))
|
||||
++i)
|
||||
|
||||
(break))))
|
||||
(doFor line speechWanted
|
||||
(speechWantedWindow.makeTextV2 line
|
||||
(object
|
||||
onClick ->_ {
|
||||
(speechWantedWindow.hide)
|
||||
(showTranscribedParts sound transcribeJson line)
|
||||
})))
|
||||
(speechWantedWindow.show)))
|
||||
|
||||
(function showTranscribedParts [:FlxSound track :haxe.DynamicAccess<Dynamic> transcribeJson :String lineLookingFor]
|
||||
(let [window (SimpleWindow.create (object))]
|
||||
(doFor =>line alts transcribeJson
|
||||
(unless (lineLookingFor.contains line) continue)
|
||||
(let [:Array<Dynamic> alts alts]
|
||||
(doFor alt alts
|
||||
(window.makeTextV2 alt.text
|
||||
(object
|
||||
onClick ->_ {
|
||||
~line
|
||||
(track.play true (* 1000.0 ~alt.start) (* 1000.0 ~alt.end))
|
||||
(FlxG.sound.list.add track) // Cannot figure out why this is needed
|
||||
}
|
||||
// TODO option to use it
|
||||
// altActions []
|
||||
)))))
|
||||
(window.show)))
|
||||
Reference in New Issue
Block a user