コード例 #1
0
        /// <summary>
        /// デバイスの追加
        /// </summary>
        public void AddDevice(int deviceNo, string deviceName)
        {
            if (IsBuiltTrack)
            {
                Error.Add(ErrorData.Type.AlreadyBuiltTrack); return;
            }
            if (deviceNo < 0)
            {
                Error.Add(ErrorData.Type.DeviceNoIsOutOfRange); return;
            }
            if (DeviceList.Count <= deviceNo)
            {
                for (var i = DeviceList.Count; i <= deviceNo; i++)
                {
                    DeviceList.Add(new SoundDevice());
                }
            }

            var DeviceType = SoundDevice.DeviceNameToType(deviceName);

            if (DeviceType == SoundDevice.DeviceType.NONE)
            {
                Error.Add(ErrorData.Type.DeviceNameIsNotSupported); return;
            }
            DeviceList[deviceNo].SetDevice(DeviceType);
        }