private void Play(bool fadeIn, double duration = 0) { if (State == AudioTrackState.Playing) { return; } _currentStream = new RawSourceWaveStream(new MemoryStream(AudioData), AudioFormat); _outputSample = CreateSampleChain(_currentStream); if (MultipartLoopEnabled) { SetupMultipartLoop(); _currentStream.CurrentTime = MultipartLoop.StartTime; } if (State == AudioTrackState.Paused) { _currentStream.CurrentTime = _pauseTime; } if (fadeIn) { _fadingProvider.BeginFadeIn(duration); } Mixer.AddMixerInput(_outputSample); State = AudioTrackState.Playing; }
public void ReloadPlayers() { Mixer.RemoveAllMixerInputs(); this.Controls.Clear(); int bottom = 0; foreach (Player player in Players) { if (!player.GroupBox.IsDisposed) { player.GroupBox.Top = bottom + 6; this.Controls.Add(player.GroupBox); bottom = player.GroupBox.Bottom; Mixer.AddMixerInput(player.Buffer.ToSampleProvider()); } } btnAddClip.Top = bottom + 6; this.Height = btnAddClip.Bottom + 50; this.Controls.Add(btnAddClip); }