public void Stop() { if (soundStream != null) { soundStream.Stop(); } PseudoClasses.Remove(":playing"); PseudoClasses.Add(":paused"); }
public void PlayMusicTrack(MusicTrack musicTrack, bool fadeIn, bool fadeOut) { // TODO: fading if (_currentTrack != null) { _currentTrack.Stop(); _currentTrack.Dispose(); } _currentTrackName = musicTrack.Name; _currentTrack = GetStream(musicTrack.File.Value.Entry); _currentTrack.Volume = (float)musicTrack.Volume; _currentTrack.Play(); }
public override void Draw() { ImGui.Spacing(); ImGui.Text("Channels: " + _source.Format.Channels); ImGui.Text("Bits per Sample: " + _source.Format.BitsPerSample); ImGui.Text("SampleRate: " + _source.Format.SampleRate); ImGui.Spacing(); ImGui.Text("Duration: " + _source.Duration); var progress = (float)(_source.Position / _source.Duration); ImGui.SliderFloat("", ref progress, 0.0f, 1.0f, "Position", 1.0f); ImGui.Spacing(); if (_playing) { // TODO: We should reset the stream at this point if (!_source.IsPlaying) { _playing = false; } if (ImGui.Button("Stop")) { _source.Stop(); _playing = false; } } else { if (ImGui.Button("Play")) { _source.Play(); _playing = true; } } }