/// <summary> /// Канал на звуковом устройстве. /// </summary> /// <param name="aChannelInfo">Данные канала, отношения.</param> /// <param name="aDevice">Физическое устройство.</param> /// <param name="aGroup">Группа, к которой принадлежит канал.</param> public OutChannel(OutChannelInfo aChannelInfo, OutputDevice aDevice, ChannelGroup aGroup) { if (aChannelInfo == null) { throw new ArgumentNullException("aChannelInfo"); } if (aDevice == null) { throw new ArgumentNullException("aDevice"); } if (aGroup == null) { throw new ArgumentNullException("aGroup"); } device = aDevice; channelInfo = aChannelInfo; group = aGroup; isWorking = false; }
/// <summary> /// Генерируем каналы для заданного устройства. /// </summary> /// <param name="aDeviceInfo">OutputDeviceInfo.</param> /// <param name="aDevice">OutputDevice.</param> private void FillOutChannels(OutputDeviceInfo aDeviceInfo, OutputDevice aDevice) { var channelsCount = aDeviceInfo.GetChannelsCount(); if (channelsCount > aDevice.GetChannelsCount()) { throw new ArgumentException("Сhannels count on phisical device is less than in configuration"); } for (var channelIndex = 0; channelIndex < channelsCount; ++channelIndex) { var channelInfo = aDeviceInfo.GetChannel(channelIndex); ChannelGroup channelGroup = null; foreach (var group in groups) { if (group.GetChannelGroupInfo().GetId() == channelInfo.GetGroup().GetId()) { channelGroup = group; break; } } if (channelGroup == null) { throw new ArgumentException("Channel group was not found for channel " + channelInfo.GetId()); } var channel = new OutChannel(channelInfo, aDevice, channelGroup); outChannels.Add(channel); } }