From 368c0735eb4bb6cdc6bb0ee9eca1bdace56be7f5 Mon Sep 17 00:00:00 2001
From: Conrad Zelck <c.zelck@ndr.de>
Date: Sun, 13 Jun 2021 16:26:58 +0200
Subject: [PATCH] feat: enable 24 bit encoding

Tool is designed to upload wav to media grid. There are 16 bit only
allowed. But now you can suffix "24" to script name and it will convert
to 24 bit automatically.

Signed-off-by: Conrad Zelck <git@simpel.cc>
---
 Pro_Audio.au3 | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/Pro_Audio.au3 b/Pro_Audio.au3
index 096fa4e..74b2030 100644
--- a/Pro_Audio.au3
+++ b/Pro_Audio.au3
@@ -3,7 +3,7 @@
 #AutoIt3Wrapper_UseX64=n
 #AutoIt3Wrapper_Res_Comment=Converting to wav with 48kHz 16bit.
 #AutoIt3Wrapper_Res_Description=Converting to wav with 48kHz 16bit.
-#AutoIt3Wrapper_Res_Fileversion=1.1.0.22
+#AutoIt3Wrapper_Res_Fileversion=1.1.0.23
 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
 #AutoIt3Wrapper_Res_CompanyName=Norddeutscher Rundfunk
 #AutoIt3Wrapper_Res_LegalCopyright=Conrad Zelck
@@ -33,6 +33,9 @@ GUICtrlCreateLabel("Analyse...", 20, 20, 130, 30)
 GUICtrlSetFont(-1, 14, 400, 0, "Lucida Sans Typewriter")
 GUISetState()
 
+Global $g_24bit = False ; for Ingest it is necessary to have 16 bit; that is default; when really pro have '24' in script name
+If StringInStr(@ScriptName, "24") Then $g_24bit = True
+
 Opt("GUICloseOnESC", 0)
 FileInstall('K:\ffmpeg\bin\ffmpeg.exe', @TempDir & "\ffmpeg.exe", $FC_OVERWRITE)
 Local $sPathFFmpeg = @TempDir & "\"
@@ -130,8 +133,13 @@ For $i = 1 To $aFileList[0]
 	GUICtrlSetData($idLabelFileName, $i & "/" & $aFileList[0] & ": " & _FileName($sCurTrack))
 	$iDelimiter = StringInStr($sCurTrack, ".", 0, -1)
 	$sCurTrackMinusExt = StringLeft($sCurTrack, $iDelimiter - 1)
-	$sCurTrackNewExt = '_48kHz_16bit.wav'
-	$sCommand = '-i "' & $sCurTrack & '" -c:a pcm_s16le -ar 48000 -y "' & $sCurTrackMinusExt & $sCurTrackNewExt & '"'
+	If  $g_24bit Then
+		$sCurTrackNewExt = '_48kHz_24bit.wav'
+		$sCommand = '-i "' & $sCurTrack & '" -c:a pcm_s24le -ar 48000 -y "' & $sCurTrackMinusExt & $sCurTrackNewExt & '"'
+	Else
+		$sCurTrackNewExt = '_48kHz_16bit.wav'
+		$sCommand = '-i "' & $sCurTrack & '" -c:a pcm_s16le -ar 48000 -y "' & $sCurTrackMinusExt & $sCurTrackNewExt & '"'
+	EndIf
 	_runFFmpeg('ffmpeg ' & $sCommand, $sPathFFmpeg)
 	GUICtrlSetData($g_idProgress, 100) ; if ffmpeg is done than set progress to 100 - sometimes last StderrRead with 100 is missed
 Next
-- 
GitLab