From c43dc875fdef686593f74a72f4b5721575e63f2d Mon Sep 17 00:00:00 2001
From: Conrad Zelck <git@simpel.cc>
Date: Fri, 9 Aug 2019 20:05:06 +0200
Subject: [PATCH] add error if number of mono tracks is uneven

Signed-off-by: Conrad Zelck <git@simpel.cc>
---
 R128.au3  | 9 +++++----
 README.md | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/R128.au3 b/R128.au3
index d4a380a..30a7c79 100644
--- a/R128.au3
+++ b/R128.au3
@@ -2,7 +2,7 @@
 #AutoIt3Wrapper_Icon=Icons\peakmeter.ico
 #AutoIt3Wrapper_Res_Comment=Measure loudness with ffmpeg according to R128.
 #AutoIt3Wrapper_Res_Description=Measure loudness with ffmpeg according to R128.
-#AutoIt3Wrapper_Res_Fileversion=1.1.0.12
+#AutoIt3Wrapper_Res_Fileversion=1.1.0.13
 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
 #AutoIt3Wrapper_Res_CompanyName=Norddeutscher Rundfunk
 #AutoIt3Wrapper_Res_LegalCopyright=Conrad Zelck
@@ -92,8 +92,9 @@ If @extended > 0 Then
 	$iMonoCount = @extended
 	If $iMonoCount = $aChannels[0] Then
 		$iLayout = $eMONO
+		If Mod($iMonoCount, 2) <> 0 Then $iLayout = 0 ; uneven counter
 	EndIf
-	ConsoleWrite("Monofiles: " & @extended & @CRLF)
+	ConsoleWrite("Monofiles: " & $iMonoCount & @CRLF)
 EndIf
 StringReplace($sChannels, "2", "2") ; just to get the count
 If @extended > 0 Then
@@ -101,7 +102,7 @@ If @extended > 0 Then
 	If $iStereoCount = $aChannels[0] Then
 		$iLayout = $eSTEREO
 	EndIf
-	ConsoleWrite("Stereofiles: " & @extended & @CRLF)
+	ConsoleWrite("Stereofiles: " & $iStereoCount & @CRLF)
 EndIf
 Local $iMeasuringPairs = 0
 Switch $iLayout
@@ -113,7 +114,7 @@ Switch $iLayout
 		ConsoleWrite("All STEREO" & @CRLF)
 	Case Else
 		ConsoleWrite("UNDEFINED Layout" & @CRLF)
-		MsgBox($MB_TOPMOST, "Error", "Track layout is undefined." & @CRLF & "Application exits.")
+		MsgBox($MB_TOPMOST, "Error", "Track layout is undefined." & @CRLF & @CRLF & "Application exits.")
 		Exit
 EndSwitch
 ConsoleWrite("Pairs for measuring: " & $iMeasuringPairs & @CRLF)
diff --git a/README.md b/README.md
index a3d6ace..014b25c 100644
--- a/README.md
+++ b/README.md
@@ -3,4 +3,5 @@ This application measures loudness according to EBU R128 with ffmpeg.
 
 You can send video or audio files to the app.
 Channel layout inside video can be mono or stereo. But mono files will temporarily merge to a stereo file at first.
+If number of mono tracks is uneven it will return an error.
 Temporary output.wav is exported to %temp% in 24bit 48kHz.
\ No newline at end of file
-- 
GitLab