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); } }
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)); } }
private void mapInputs(AsioOut driver) { var inputCount = driver.DriverInputChannelCount; var inputs = new List <ISignalSource>(); floatBuffer = new float[inputCount][]; for (int i = 0; i < inputCount; i++) { var source = new SignalSource(this); source.Name = driver.AsioInputChannelName(i); inputs.Add(source); } this.Sources = inputs; }
private IEnumerable <IWaveInSource> InitSources(string device) { try { using (var driver = new AsioOut(device)) return(new ReadOnlyCollection <IWaveInSource>(Enumerable .Range(0, driver.DriverInputChannelCount) .Select(i => new AsioWaveInSource(this, i, driver.AsioInputChannelName(i))) .Cast <IWaveInSource>() .ToList())); } catch (Exception e) { Debug.WriteLine(e); return(Enumerable.Empty <IWaveInSource>()); } }