From 3a6ed62282dc91e801d6839b8bfeefbae0723bf4 Mon Sep 17 00:00:00 2001 From: Jiiniasu Date: Sun, 6 Mar 2016 20:04:06 +0100 Subject: [PATCH] Edit IsMicConfig to fix "accidental" wiping of microphone config Previously Vocaluxe would autoassign player 1 and 2 if these players were both configured on channels higher than 2. Mashed together IsMicConfig() and IsMicConfig(int player) to handle both specific and any player microphone config check. --- Vocaluxe/Base/CConfig.cs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index b64dd215..67d6bcac 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -520,31 +520,27 @@ namespace Vocaluxe.Base return (1f / Config.Graphics.MaxFPS) * 1000f; } - /// - /// Checks, if there is a mic-configuration - /// - /// - public static bool IsMicConfig() - { - ReadOnlyCollection devices = CRecord.GetDevices(); - if (devices == null) - return false; - - return devices.Any(t => t.PlayerChannel[0] != 0 || t.PlayerChannel[1] != 0); - } - /// /// Checks, if there is a mic-configuration /// /// Player-Number /// - public static bool IsMicConfig(int player) + public static bool IsMicConfig(int player = 0) { ReadOnlyCollection devices = CRecord.GetDevices(); if (devices == null) return false; - return devices.Any(t => t.PlayerChannel.Contains(player)); + if (player > 0) + return devices.Any(t => t.PlayerChannel.Contains(player)); + + for (int p = 0; p < CSettings.MaxNumPlayer; ++p) + if (devices.Any(t => t.PlayerChannel.Contains(p+1))) + { + return true; + } + + return false; } public static int GetMaxNumMics()