public void OpenPlugin(IFrontendController frontend, int outputDevice, int bufferSizeInMs) { this.Stop(); try { this._inputType = StreamControl.InputType.Plugin; this._frontend = frontend; this._inputSampleRate = this._frontend.Samplerate; this._outputDevice = outputDevice; this._bufferSizeInMs = bufferSizeInMs; this._inputBufferSize = (int) ((double) this._bufferSizeInMs * this._inputSampleRate / 1000.0); this._decimationStageCount = this.GetDecimationStageCount(); if (this._inputBufferSize == 0) throw new ArgumentException("The source '" + (object) this._frontend + "' is not ready"); int num = (int) Math.Pow(2.0, (double) this._decimationStageCount); this._inputBufferSize = this._inputBufferSize / num * num; this._inputBufferSize = this._inputBufferSize / StreamControl._processorCount * StreamControl._processorCount; this._bufferSizeInMs = (int) Math.Round((double) this._inputBufferSize / this._inputSampleRate * 1000.0); this._outputSampleRate = this._inputSampleRate / (double) num; this._outputBufferSize = this._inputBufferSize / num * 2; } catch { this.Stop(); throw; } }
public void OpenSoundDevice(int inputDevice, int outputDevice, double inputSampleRate, int bufferSizeInMs) { this.Stop(); this._inputType = StreamControl.InputType.SoundCard; this._inputDevice = inputDevice; this._outputDevice = outputDevice; this._inputSampleRate = inputSampleRate; this._bufferSizeInMs = bufferSizeInMs; this._inputBufferSize = (int) ((double) this._bufferSizeInMs * this._inputSampleRate / 1000.0); if (this._inputDevice == this._outputDevice) { this._decimationStageCount = 0; this._outputSampleRate = this._inputSampleRate; this._outputBufferSize = this._inputBufferSize * 2; } else { this._decimationStageCount = this.GetDecimationStageCount(); int num = (int) Math.Pow(2.0, (double) this._decimationStageCount); this._inputBufferSize = this._inputBufferSize / num * num; this._inputBufferSize = this._inputBufferSize / StreamControl._processorCount * StreamControl._processorCount; this._bufferSizeInMs = (int) Math.Round((double) this._inputBufferSize / this._inputSampleRate * 1000.0); this._outputSampleRate = this._inputSampleRate / (double) num; this._outputBufferSize = this._inputBufferSize / num * 2; } }
public void OpenFile(string filename, int outputDevice, int bufferSizeInMs) { this.Stop(); try { this._inputType = StreamControl.InputType.WaveFile; this._waveFile = new WaveFile(filename); this._outputDevice = outputDevice; this._bufferSizeInMs = bufferSizeInMs; this._inputSampleRate = (double) this._waveFile.SampleRate; this._inputBufferSize = (int) ((double) this._bufferSizeInMs * this._inputSampleRate / 1000.0); this._decimationStageCount = this.GetDecimationStageCount(); int num = (int) Math.Pow(2.0, (double) this._decimationStageCount); this._inputBufferSize = this._inputBufferSize / num * num; this._inputBufferSize = this._inputBufferSize / StreamControl._processorCount * StreamControl._processorCount; this._bufferSizeInMs = (int) Math.Round((double) this._inputBufferSize / this._inputSampleRate * 1000.0); this._outputSampleRate = this._inputSampleRate / (double) num; this._outputBufferSize = this._inputBufferSize / num * 2; } catch { this.Stop(); throw; } }