namespace PlotDirector.Companion.Agent; public static class AudioSourceSelection { public static string? Key(string? bound, string? selected, IEnumerable controllable) { if (!string.IsNullOrEmpty(bound)) return selected == null || selected == bound ? bound : null; if (selected != null) return selected; var candidates = controllable.Take(2).ToArray(); return candidates.Length == 1 ? candidates[0] : null; } }