WIP system for cutting voice tracks with UI

This commit is contained in:
2025-11-08 09:07:33 -06:00
parent 0403377b07
commit f113592337
3 changed files with 57 additions and 1 deletions

View File

@@ -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

View 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 {}

View 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)))