@echo off
echo Goldwave executable file: C:\Program Files\GoldWave\GoldWave.exe
set goldwavePath=C:\Program Files\GoldWave\GoldWave.exe
echo "
echo fsbank executable file: C:\GH\edit\fmod\tools\fsbank.exe
set fsbankPath=C:\GH\edit\fmod\tools\fsbank.exe
echo "
echo Where you want to store your new fsb files: C:\GH\currentProject\fsb
set songsDir=C:\GH\currentProject\fsb
echo "
echo Folder containing your DAT and WAD file: C:\GH\currentProject\music
set wadDir=C:\GH\puppetz_2\Bonus Songs\Metallica - Mercyful Fate
echo "
echo StdDatEdit executable file: C:\GH\edit\StdDatEdit\StdDatEdit.exe
set StdDatEdit=C:\GH\edit\StdDatEdit\StdDatEdit.exe
echo "
echo "

set songname=metalheavylady
set importDir="C:\GH\puppetz_2\Bonus Songs\Metallica - Mercyful Fate"
CALL :importNewSong



:importNewSong


:importGuitarTrack
set guitarTrack=guitar.ogg
echo Converting guitar track
"%goldwavePath%" /process:GH3mono "%importDir%\%guitarTrack%"
echo Creating directory for guitar track
mkdir "%songsDir%\%songName%\guitar"
echo Moving and renaming guitar track to "%songsDir%\%songName%\guitar\%songName%_guitar.wav"
FOR /F "delims=." %%g IN ("%guitarTrack%") do set guitar=%%g
move "%importDir%\%guitar%.wav" "%songsDir%\%songName%\guitar\%songName%_guitar.wav"
echo Creating FMOD sound bank file
"%fsbankPath%" -o "%songsDir%\%songName%_guitar.wav.fsb" "%songsDir%\%songName%\guitar" -p cross -f adpcm -h


:importSongTrack
set songTrack=song.ogg
echo Converting song track
"%goldwavePath%" /process:GH3mono "%importDir%\%songTrack%"
echo Creating directory for song track
mkdir "%songsDir%\%songName%\song"
echo Moving and renaming song track to "%songsDir%\%songName%\song\%songName%_song.wav"
FOR /F "delims=." %%g IN ("%songTrack%") do set song=%%g
move "%importDir%\%song%.wav" "%songsDir%\%songName%\song\%songName%_song.wav"
echo Creating FMOD sound bank file
"%fsbankPath%" -o "%songsDir%\%songName%_song.wav.fsb" "%songsDir%\%songName%\song" -p cross -f adpcm -h


:importRhythmTrack
set rhythmTrack=rhythm.ogg
echo Converting rhythm track
"%goldwavePath%" /process:GH3rhythm "%importDir%\%rhythmTrack%"
echo Creating directory for rhythm track
mkdir "%songsDir%\%songName%\rhythm"
echo Moving and renaming rhythm track to "%songsDir%\%songName%\rhythm\%songName%_rhythm.wav"
FOR /F "delims=." %%g IN ("%rhythmTrack%") do set rhythm=%%g
move "%importDir%\%rhythm%.wav" "%songsDir%\%songName%\rhythm\%songName%_rhythm.wav"
echo Creating FMOD sound bank file
"%fsbankPath%" -o "%songsDir%\%songName%_rhythm.wav.fsb" "%songsDir%\%songName%\rhythm" -p cross -f adpcm -h


:importPreviewTrack
echo Generating song preview
"%goldwavePath%" /process:Mix "%importDir%\%guitarTrack%" "-clipboard:%importDir%\%rhythmTrack%"
"%goldwavePath%" /process:GH3preview "%importDir%\%songTrack%" "-clipboard:%importDir%\%guitar%.wav"
cd "%importDir%"
del "%guitar%.wav"
echo Creating directory for preview track
mkdir "%songsDir%\%songName%\preview"
echo Moving and renaming preview track to "%songsDir%\%songName%\preview\%songName%_preview.wav"
move "%importDir%\%song%.wav" "%songsDir%\%songName%\preview\%songName%_preview.wav"
echo Creating FMOD sound bank file
"%fsbankPath%" -o "%songsDir%\%songName%_preview.wav.fsb" "%songsDir%\%songName%\preview" -p cross -f adpcm -h

:exportDatWad
echo Importing sound banks into DAT and WAD files
"%StdDatEdit%" "%wadDir%\%songName%.dat.ngc" "%wadDir%\%songName%.wad.ngc" -replace_qbkey %songName%_guitar "%songsDir%\%songName%_guitar.wav.fsb" -replace_qbkey %songName%_rhythm "%songsDir%\%songName%_rhythm.wav.fsb" -replace_qbkey %songName%_song "%songsDir%\%songName%_song.wav.fsb" -replace_qbkey %songName%_preview "%songsDir%\%songName%_preview.wav.fsb" 


echo Deleting unneeded C header files
cd "%songsDir%"
del *.h

GOTO :eof