// 1 oct 22.5Hz to approx. 20000Hz ... 10 variations public bool Start() { m_inputChannelNum = listBoxInput.SelectedIndex; double startFreq = 22.5; double endFreq = 20000.0; int nSamples = SAMPLE_RATE; System.Diagnostics.Debug.Assert(SAMPLE_RATE <= nSamples); int nFreq = 0; for (double f = startFreq; f < endFreq; f *= Math.Pow(2, 1.0 / 3.0)) { ++nFreq; } m_seconds = nFreq; int[] outputData = new int[nFreq * nSamples]; int pos = 0; for (double f = startFreq; f < endFreq; f *= Math.Pow(2, 1.0 / 3.0)) { for (int i = 0; i < nSamples; ++i) { outputData[pos + i] = 0; } for (int i = 0; i < SAMPLE_RATE * (int)numericUpDownPulseCount.Value / f; ++i) { outputData[pos + i] = (int)(System.Int32.MaxValue * Math.Sin(2.0 * Math.PI * (i * f / SAMPLE_RATE))); } pos += nSamples; } foreach (int idx in listBoxOutput.SelectedIndices) { asio.OutputSet(idx, outputData, false); } asio.InputSet(listBoxInput.SelectedIndex, outputData.Length); if (0 <= listBoxClockSources.SelectedIndex) { asio.ClockSourceSet(listBoxClockSources.SelectedIndex); } asio.Start(); progressBar1.Value = 0; progressBar1.Visible = true; bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.DoWork += new DoWorkEventHandler(DoWork); bw.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RunWorkerCompleted); bw.RunWorkerAsync(); buttonStop.Enabled = true; return(true); }