Exemple #1
0
        public AsioCard(
            WaveFormat format,
            AsioOut driver, 
            AsioInputMapper inputMapper, 
            AsioOutputMapper outputMapper)
        {
            if (format == null)
            {
                throw new ArgumentNullException("format", "Must specify an audio format");
            }

            if (driver == null)
            {
                throw new ArgumentNullException("driver", "Asio driver cannot be null");
            }

            if (inputMapper == null)
            {
                throw new ArgumentNullException("inputMapper", "Asio input mapper cannot be null");
            }

            if (outputMapper == null)
            {
                throw new ArgumentNullException("outputMapper", "Asio output mapper cannot be null");
            }

            this.format = format;
            this.driver = driver;
            this.inputMapper = inputMapper;
            this.outputMapper = outputMapper;
        }
Exemple #2
0
        public AsioCard(
            WaveFormat format,
            AsioOut driver,
            AsioInputMapper inputMapper,
            AsioOutputMapper outputMapper)
        {
            if (format == null)
            {
                throw new ArgumentNullException("format", "Must specify an audio format");
            }

            if (driver == null)
            {
                throw new ArgumentNullException("driver", "Asio driver cannot be null");
            }

            if (inputMapper == null)
            {
                throw new ArgumentNullException("inputMapper", "Asio input mapper cannot be null");
            }

            if (outputMapper == null)
            {
                throw new ArgumentNullException("outputMapper", "Asio output mapper cannot be null");
            }

            this.format       = format;
            this.driver       = driver;
            this.inputMapper  = inputMapper;
            this.outputMapper = outputMapper;
        }
Exemple #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));
            }
        }