diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-04-17 11:04:50 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-04-17 11:21:32 -0400 |
commit | ebd952da2f50f73afa30554b0a0ad1a4dc5c7c63 (patch) | |
tree | 72ad6e3c4bda15d531f8cb90f7f9d85fec135f31 | |
parent | 613a1432d6be69ebf68fb4cf86545757a5f7c602 (diff) | |
download | rockbox-ebd952da2f.tar.gz rockbox-ebd952da2f.zip |
voice: minor refactoring in the voice gen script
Change-Id: If0082ca2cb89e36fd5a1c4664cad0c594501db31
-rwxr-xr-x | tools/voice.pl | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/voice.pl b/tools/voice.pl index 9398b58b47..08f6bad509 100755 --- a/tools/voice.pl +++ b/tools/voice.pl @@ -335,7 +335,7 @@ sub synchronize { # Run genlang and create voice clips for each string sub generateclips { our $verbose; - my ($language, $target, $encoder, $encoder_opts, $tts_engine, $tts_engine_opts, $existingids) = @_; + my ($language, $target, $encoder, $encoder_opts, $tts_object, $tts_engine_opts, $existingids) = @_; my $english = dirname($0) . '/../apps/lang/english.lang'; my $langfile = dirname($0) . '/../apps/lang/' . $language . '.lang'; my $correctionsfile = dirname($0) . '/voice-corrections.txt'; @@ -362,7 +362,6 @@ sub generateclips { } open(VOICEFONTIDS, " < $idfile"); - my $tts_object = init_tts($tts_engine, $tts_engine_opts, $language); # add string corrections to tts_object. my @corrects = (); open(VOICEREGEXP, "<$correctionsfile") or die "Can't open corrections file!\n"; @@ -419,7 +418,7 @@ sub generateclips { # If we have a pool of snippets, see if the string exists there first if (defined($ENV{'POOL'})) { $pool_file = sprintf("%s/%s-%s.enc", $ENV{'POOL'}, - md5_hex(Encode::encode_utf8("$voice $tts_engine $tts_engine_opts $encoder_opts")), + md5_hex(Encode::encode_utf8("$voice ". $tts_object->{"name"}." $tts_engine_opts $encoder_opts")), $language); if (-f $pool_file) { printf("Re-using %s (%s) from pool\n", $id, $voice) if $verbose; @@ -589,6 +588,8 @@ if (defined($v) or defined($ENV{'V'})) { # add the tools dir to the path temporarily, for calling various tools $ENV{'PATH'} = dirname($0) . ':' . $ENV{'PATH'}; +my $tts_object = init_tts($s, $S, $l); + # Do what we're told if ($V == 1) { # Only do the panic cleanup for voicefiles @@ -598,17 +599,14 @@ if ($V == 1) { printf("Generating voice\n Target: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n", defined($t) ? $t : "unknown", $l, $e, $E, $s, $S); - generateclips($l, $t, $e, $E, $s, $S, $f); + generateclips($l, $t, $e, $E, $tts_object, $S, $f); createvoice($l, $i, $f); deleteencs(); -} -elsif ($C) { +} elsif ($C) { printf("Generating .talk clips\n Path: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n", $ARGV[0], $l, $e, $E, $s, $S); - my $tts_object = init_tts($s, $S, $l); gentalkclips($ARGV[0], $tts_object, $e, $E, $S, 0); shutdown_tts($tts_object); -} -else { +} else { printusage(); exit 1; } |