diff --git a/tests/.gitignore b/tests/.gitignore index f1169409..d4307fbc 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,3 +1,4 @@ *-core *-lib sanity +*.ogg diff --git a/tests/Music/Hyrule_Symphony.album b/tests/Music/Hyrule_Symphony.album new file mode 100644 index 00000000..5ad2d556 --- /dev/null +++ b/tests/Music/Hyrule_Symphony.album @@ -0,0 +1,16 @@ +Koji Kondo +1998 Hyrule Symphony +Game +243 Title Theme +130 Kokiri Forest +227 Hyrule Field +130 Hyrule Castle +206 Lon Lon Ranch +186 Kakariko Village +178 Death Mountain +221 Zora's Domain +273 Gerudo Valley +66 Ganondorf +185 Princess Zelda +232 Ocarina Medley +288 The Legend of Zelda Medley diff --git a/tests/Music/Sconscript b/tests/Music/Sconscript new file mode 100644 index 00000000..a82bd8e7 --- /dev/null +++ b/tests/Music/Sconscript @@ -0,0 +1,7 @@ +#!/usr/bin/python +import subprocess + +albums = [ "Hyrule_Symphony.album" ] + +for album in albums: + subprocess.call(["sh", "gen_tracks.sh", album]) diff --git a/tests/Music/gen_tracks.sh b/tests/Music/gen_tracks.sh new file mode 100644 index 00000000..d2b36ea2 --- /dev/null +++ b/tests/Music/gen_tracks.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +TRACK=1 +FFMPEG="ffmpeg -hide_banner -nostdin -f s16le -i /dev/zero -codec libvorbis -loglevel warning" + +while read -r line; do + if [ -z "$ARTIST" ]; then + ARTIST="$line" + elif [ -z "$ALBUM" ]; then + YEAR=$(echo "$line" | cut -f 1 -d ' ') + ALBUM=$(echo "$line" | cut -f 1 -d ' ' --complement) + mkdir -p "$ALBUM" + elif [ -z "$GENRE" ]; then + GENRE="$line" + else + LENGTH=$(echo "$line" | cut -f 1 -d ' ') + TITLE=$(echo "$line" | cut -f -1 -d ' ' --complement) + NUMBER=$(printf "%02d" $TRACK) + FILE="$ALBUM/$NUMBER - $TITLE.ogg" + + if [ ! -f "$FILE" ]; then + echo "$FILE" + $FFMPEG -t "$LENGTH" "$FILE" + vorbiscomment -w "$FILE" -t "TITLE=$TITLE" \ + -t "ARTIST=$ARTIST" \ + -t "ALBUM=$ALBUM" \ + -t "GENRE=$GENRE" \ + -t "DATE=$YEAR" \ + -t "TRACKNUMBER=$NUMBER" + fi + + let TRACK=$TRACK+1 + fi +done < $1 diff --git a/tests/Sconscript b/tests/Sconscript index 056804f9..89bd0e99 100644 --- a/tests/Sconscript +++ b/tests/Sconscript @@ -26,6 +26,9 @@ def UnitTest(test, sources): return run Export("UnitTest") +#Generate empty audio files +SConscript("Music/Sconscript") + res = SConscript("core/Sconscript") if check_sanity == True: res = [ UnitTest("sanity", [ "sanity.c" ]) ] + res