From 37aeb12cc99cc22f62c44d5b0adcae35d0c471d8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 23 Dec 2006 22:03:49 +0000 Subject: If the environment variable 'POOL' is set to a directory, this script will then check if there's a previously generated mp3 file in it and if so, use that instead of regenerating a new one. This should greately enhance processing speed when many phrases are similar between targets and over time. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11835 a1c6a512-1295-4272-9138-f99709370657 --- tools/genvoice.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/genvoice.sh b/tools/genvoice.sh index 5b667ea3ba..f32ab9476a 100755 --- a/tools/genvoice.sh +++ b/tools/genvoice.sh @@ -73,9 +73,31 @@ generateclips() { # String STRING=`echo $line |cut -b 8-` - # Now generate the file - voice "$STRING" "$TEMPDIR/$ID".wav - encode "$TEMPDIR/$ID".wav "$TEMPDIR/$ID".mp3 + if [ -n "$POOL" ]; then + # we have a common pool of snippets, check that first + # for available mp3 sounds, and if it is available copy + # (symlink!) it over + if [ -f "$POOL/$STRING.mp3" ]; then + echo "Re-using $ID from pool" + if [ ! -e "$TEMPDIR/$ID".mp3 ]; then + # only do this if not present + ln -s "$POOL/$STRING.mp3" "$TEMPDIR/$ID".mp3 + fi + fi + fi + + # only make an mp3 if not already present + if [ ! -e "$TEMPDIR/$ID".mp3 ]; then + # Now generate the file + voice "$STRING" "$TEMPDIR/$ID".wav + if [ -n "$POOL" ]; then + # create it in the pool, symlink it back + encode "$TEMPDIR/$ID".wav "$POOL/$STRING".mp3 + ln -s "$POOL/$STRING.mp3" "$TEMPDIR/$ID".mp3 + else + encode "$TEMPDIR/$ID".wav "$TEMPDIR/$ID".mp3 + fi + fi ;; esac i=`expr $i + 1` -- cgit v1.2.3