Пример #1
0
        private void GetChannelNames(RealtimeHostConfig config)
        {
            if (config == null)
            {
                InputNames  = new string[0];
                OutputNames = new string[0];
                return;
            }

            var inputDeviceInfo  = PortAudio.Pa_GetDeviceInfo(config.InputDeviceID);
            var outputDeviceInfo = PortAudio.Pa_GetDeviceInfo(config.OutputDeviceID);

            InputNames = Enumerable.Range(0, inputDeviceInfo.maxInputChannels)
                         .Select(ch =>
            {
                string chName = null;
                PortAudio.PaAsio_GetInputChannelName((PortAudio.PaDeviceIndex)config.InputDeviceID, ch, ref chName);
                return((ch + 1) + ": " + chName);
            })
                         .ToArray();

            OutputNames = Enumerable.Range(0, outputDeviceInfo.maxOutputChannels)
                          .Select(ch =>
            {
                string chName = null;
                PortAudio.PaAsio_GetOutputChannelName((PortAudio.PaDeviceIndex)config.OutputDeviceID, ch, ref chName);
                return((ch + 1) + ": " + chName);
            })
                          .ToArray();
        }