Пример #1
0
 private void comboBoxAsioDriver_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         using (var asio = new AsioOut(SelectedDeviceName))
         {
             //asio.ShowControlPanel();
             int nrOfChannelOUTDevices = asio.DriverOutputChannelCount;
             int nrOfChannelINDevices = asio.DriverInputChannelCount;
             listBoxInputs.Items.Clear();
             listBoxOutputs.Items.Clear();
             for (int i = 0; i < nrOfChannelOUTDevices; i++)
             {
                 string name = asio.AsioInputChannelName(i);
                 listBoxInputs.Items.Add(name);
             }
             for (int i = 0; i < nrOfChannelINDevices; i++)
             {
                 string name = asio.AsioOutputChannelName(i);
                 listBoxOutputs.Items.Add(name);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
        public static string[] GetChannels(string driver)
        {
            using AsioOut tempOut = new AsioOut(driver);
            string[] channels = new string[tempOut.DriverOutputChannelCount];

            for (int i = 0; i < tempOut.DriverOutputChannelCount; i++)
            {
                channels[i] = tempOut.AsioOutputChannelName(i);
            }

            return(channels);
        }
Пример #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            var deviceIndex = cmbDevice.SelectedIndex;

            asioDriver = new AsioOut(deviceIndex);
            asioDriver.ChannelOffset = 0;

            var monoFormat   = WaveFormat.CreateIeeeFloatWaveFormat(44100, 1);
            var stereoFormat = WaveFormat.CreateIeeeFloatWaveFormat(44100, 2);

            //waveIn = new WaveIn();
            //waveOut = new WaveOut();

            //waveIn.BufferMilliseconds = 10;
            //waveOut.DesiredLatency = 10;

            new Thread(() =>
            {
                asioInput  = new AsioInputMapper();
                asioOutput = new AsioOutputMapper();
                asioCard   = new AsioCard(monoFormat, asioDriver, asioInput, asioOutput);
                asioCard.Start();

                //waveCard = new WaveCard(stereoFormat, waveIn, waveOut, new WaveInputMapper(), new WaveOutputMapper());
                //waveCard.Start();

                BuildAudioInChain(monoFormat);

                signalNetworkForm.SignalNetworkControl.Nodes = new ObservableCollection <ISignalNode>();

                signalNetworkForm.SignalNetworkControl.Nodes.Add(asioInput);
                signalNetworkForm.SignalNetworkControl.Nodes.Add(flangerNode);
                signalNetworkForm.SignalNetworkControl.Nodes.Add(filterNode);
                signalNetworkForm.SignalNetworkControl.Nodes.Add(fourierNode);
                signalNetworkForm.SignalNetworkControl.Nodes.Add(asioOutput);



                //BuildSineWaveChain(stereoFormat);
            }).Start();

            for (int i = 0; i < asioDriver.DriverInputChannelCount; i++)
            {
                cboChannelIn.Items.Add(asioDriver.AsioInputChannelName(i));
            }

            for (int i = 0; i < asioDriver.DriverOutputChannelCount; i++)
            {
                cboChannelOut.Items.Add(asioDriver.AsioOutputChannelName(i));
            }
        }
Пример #4
0
        private void mapOutputs(AsioOut driver)
        {
            var channelCount = driver.DriverOutputChannelCount;

            receivedData = new float[channelCount][];

            var outputs = new List <ISignalSink>();

            for (int i = 0; i < channelCount; i++)
            {
                var output = new SignalSink(this, i);
                output.ReceivedData += output_ReceivedData;
                output.Name          = driver.AsioOutputChannelName(i);

                receivedData[i] = null;

                outputs.Add(output);
            }
            Sinks = outputs;
        }
Пример #5
0
 private IEnumerable <IWaveOutSource> InitSources(string device)
 {
     try
     {
         using (var driver = new AsioOut(device))
             return(new ReadOnlyCollection <IWaveOutSource>(Enumerable
                                                            .Range(0, driver.DriverOutputChannelCount)
                                                            .Select(i => new AsioWaveOutSource(this, i, driver.AsioOutputChannelName(i)))
                                                            .Cast <IWaveOutSource>()
                                                            .ToList()));
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         return(Enumerable.Empty <IWaveOutSource>());
     }
 }