Revert "Revert "allow voice line alts""
This reverts commit 4fa9ee94ab
.
This commit is contained in:
@@ -87,11 +87,11 @@ for (audio_guess, possible_sections) in timestamps.items():
|
|||||||
return data[start_frame:end_frame], end - start
|
return data[start_frame:end_frame], end - start
|
||||||
|
|
||||||
print('\033[31m' + audio_guess + '\033[0m')
|
print('\033[31m' + audio_guess + '\033[0m')
|
||||||
print(f'{takes}/u({takes})/d/f/n/h/q')
|
print(f'{takes}/u({takes}/*)/d/f/n/h/q')
|
||||||
while True:
|
while True:
|
||||||
choice = getch()
|
choice = getch()
|
||||||
if choice == 'h':
|
if choice == 'h':
|
||||||
print(f'{num_takes} takes. Type {takes} to play one. Type u + {takes} to use one of them. Type f to search ahead for a word or phrase. Type n to repeat a search. Type d to discard this snippet. Type q to quit')
|
print(f'{num_takes} takes. Type {takes} to play one. Type u + {takes} to use one of them. u* to use all of them. Type f to search ahead for a word or phrase. Type n to repeat a search. Type d to discard this snippet. Type q to quit')
|
||||||
elif choice == 'd':
|
elif choice == 'd':
|
||||||
break
|
break
|
||||||
elif choice != '/' and choice in takes:
|
elif choice != '/' and choice in takes:
|
||||||
@@ -109,7 +109,26 @@ for (audio_guess, possible_sections) in timestamps.items():
|
|||||||
save()
|
save()
|
||||||
elif choice == 'u':
|
elif choice == 'u':
|
||||||
choice = getch()
|
choice = getch()
|
||||||
if choice != '/' and choice in takes:
|
if choice == '*':
|
||||||
|
# use all the takes
|
||||||
|
print('using all')
|
||||||
|
line_with_alts = {}
|
||||||
|
choices = takes.split('/')
|
||||||
|
audio, length = audio_and_length(choices[0])
|
||||||
|
new_data = vstack((new_data, audio))
|
||||||
|
line_with_alts['start'] = current_sec
|
||||||
|
line_with_alts['end'] = current_sec + length
|
||||||
|
current_sec += length
|
||||||
|
alts = []
|
||||||
|
for choice in choices[1:]:
|
||||||
|
audio, length = audio_and_length(choices[0])
|
||||||
|
alts.append({'start': current_sec, 'end': current_sec + length})
|
||||||
|
current_sec += length
|
||||||
|
new_data = vstack((new_data, audio))
|
||||||
|
line_with_alts['alts'] = alts
|
||||||
|
new_json[audio_guess] = line_with_alts
|
||||||
|
break
|
||||||
|
elif choice != '/' and choice in takes:
|
||||||
audio, length = audio_and_length(choice)
|
audio, length = audio_and_length(choice)
|
||||||
new_json[audio_guess] = {
|
new_json[audio_guess] = {
|
||||||
'start': current_sec,
|
'start': current_sec,
|
||||||
|
@@ -22,7 +22,8 @@ enum DelayHandling {
|
|||||||
typedef VoiceLine = {
|
typedef VoiceLine = {
|
||||||
trackKey:String,
|
trackKey:String,
|
||||||
start:Float,
|
start:Float,
|
||||||
end:Float
|
end:Float,
|
||||||
|
?alts:Array<VoiceLine>
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CreditsLine {
|
enum CreditsLine {
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
(method _currentScene [] (dictGet scenes sceneKey))
|
(method _currentScene [] (dictGet scenes sceneKey))
|
||||||
|
|
||||||
(prop &mut :Map<String,String> intercutMap)
|
(prop &mut :Map<String,String> intercutMap)
|
||||||
|
(prop &mut :Map<String,Int> altIdx (new Map))
|
||||||
(method :Void showDialog [actorName dialogType wryly text cc]
|
(method :Void showDialog [actorName dialogType wryly text cc]
|
||||||
(when intercutMap
|
(when intercutMap
|
||||||
(whenLet [sceneForActor (dictGet intercutMap actorName)]
|
(whenLet [sceneForActor (dictGet intercutMap actorName)]
|
||||||
@@ -47,6 +48,22 @@
|
|||||||
// Otherwise, assume it is un-voiced super text
|
// Otherwise, assume it is un-voiced super text
|
||||||
(when (and actorName (< 0 (count voiceTracks)))
|
(when (and actorName (< 0 (count voiceTracks)))
|
||||||
(case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null))
|
(case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null))
|
||||||
|
((objectWith trackKey start end alts)
|
||||||
|
(case (dictGet altIdx "$actorName $text")
|
||||||
|
(null
|
||||||
|
(dictSet altIdx "$actorName $text" 0)
|
||||||
|
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc))
|
||||||
|
((when (>= idx alts.length) idx)
|
||||||
|
(dictSet altIdx "$actorName $text" 0)
|
||||||
|
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc))
|
||||||
|
(idx
|
||||||
|
(let [alt (nth alts idx)
|
||||||
|
start alt.start
|
||||||
|
end alt.end]
|
||||||
|
(+= (dictGet altIdx "$actorName $text") 1)
|
||||||
|
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc))))
|
||||||
|
|
||||||
|
(set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)}))
|
||||||
((objectWith trackKey start end)
|
((objectWith trackKey start end)
|
||||||
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)
|
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)
|
||||||
(set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)}))
|
(set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)}))
|
||||||
@@ -60,7 +77,11 @@
|
|||||||
(dictSet voiceTracksPerActor actorName (+ 1 actorNumVoiceTracks))
|
(dictSet voiceTracksPerActor actorName (+ 1 actorNumVoiceTracks))
|
||||||
(dictSet voiceTracks trackKey track)
|
(dictSet voiceTracks trackKey track)
|
||||||
(doFor =>key line (lines.keyValueIterator)
|
(doFor =>key line (lines.keyValueIterator)
|
||||||
(dictSet voiceLines "$actorName $key" (objectWith [start line.start end line.end] trackKey)))))
|
(let [:Array<VoiceLine> alts
|
||||||
|
(if line.alts
|
||||||
|
(for alt (the Array<Dynamic> line.alts) (objectWith [start alt.start end alt.end] trackKey))
|
||||||
|
[])]
|
||||||
|
(dictSet voiceLines "$actorName $key" (objectWith [start line.start end line.end] trackKey alts))))))
|
||||||
|
|
||||||
(defNew
|
(defNew
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user