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.
This commit is contained in:
Jiiniasu committed 2016-03-06 20:04:06 +01:00
1 parent 139579a1ca
commit 3a6ed62282
1 file changed
+11 -15
+11 -15
View File
@@ -520,31 +520,27 @@ namespace Vocaluxe.Base
return (1f / Config.Graphics.MaxFPS) * 1000f;
}
/// <summary>
/// Checks, if there is a mic-configuration
/// </summary>
/// <returns></returns>
public static bool IsMicConfig()
{
ReadOnlyCollection<CRecordDevice> devices = CRecord.GetDevices();
if (devices == null)
return false;
return devices.Any(t => t.PlayerChannel[0] != 0 || t.PlayerChannel[1] != 0);
}
/// <summary>
/// Checks, if there is a mic-configuration
/// </summary>
/// <param name="player">Player-Number</param>
/// <returns></returns>
public static bool IsMicConfig(int player)
public static bool IsMicConfig(int player = 0)
{
ReadOnlyCollection<CRecordDevice> 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()