/// <summary> /// Adds a new mixer input /// </summary> /// <param name="mixerInput">Mixer input</param> public void AddSequencingInput(RenderItemSampleProvider mixerInput) { // we'll just call the lock around add since we are protecting against an AddMixerInput at // the same time as a Read, rather than two AddMixerInput calls at the same time lock (sources) { if (this.sources.Count >= maxInputs) { throw new InvalidOperationException("Too many mixer inputs"); } this.sources.Add(mixerInput); lastSample = Math.Max(lastSample, mixerInput.LastSample); } if (this.waveFormat == null) { this.waveFormat = mixerInput.WaveFormat; } else { if (this.WaveFormat.SampleRate != mixerInput.WaveFormat.SampleRate || this.WaveFormat.Channels != mixerInput.WaveFormat.Channels) { throw new ArgumentException("All mixer inputs must have the same WaveFormat"); } } }
/// <summary> /// Adds a new mixer input /// </summary> /// <param name="mixerInput">Mixer input</param> public void AddSequencingInput(RenderItemSampleProvider mixerInput) { // we'll just call the lock around add since we are protecting against an AddMixerInput at // the same time as a Read, rather than two AddMixerInput calls at the same time lock (sources) { if (this.sources.Count >= maxInputs) { throw new InvalidOperationException("Too many mixer inputs"); } this.sources.Add(mixerInput); lastSample = Math.Max(lastSample, mixerInput.LastSample); } if (this.waveFormat == null) { this.waveFormat = mixerInput.WaveFormat; } else { if (this.WaveFormat.SampleRate != mixerInput.WaveFormat.SampleRate || this.WaveFormat.Channels != mixerInput.WaveFormat.Channels) { throw new ArgumentException("All mixer inputs must have the same WaveFormat"); } } }
/// <summary> /// Removes a mixer input /// </summary> /// <param name="mixerInput">Mixer input to remove</param> public void RemoveMixerInput(RenderItemSampleProvider mixerInput) { lock (sources) { this.sources.Remove(mixerInput); lastSample = 0; foreach (var input in sources) { lastSample = Math.Max(lastSample, input.LastSample); } } }
/// <summary> /// Removes a mixer input /// </summary> /// <param name="mixerInput">Mixer input to remove</param> public void RemoveMixerInput(RenderItemSampleProvider mixerInput) { lock (sources) { this.sources.Remove(mixerInput); lastSample = 0; foreach (var input in sources) { lastSample = Math.Max(lastSample, input.LastSample); } } }