protected virtual void Dispose(bool disposing) { if (IsDisposed) { return; } if (!MasterVoice.IsDisposed) { MasterVoice.DestroyVoice(); MasterVoice.Dispose(); } if (!Mixer.IsDisposed) { Mixer.StopEngine(); Mixer.Dispose(); } if (disposing) { MasterVoice = null; Mixer = null; } IsDisposed = true; }
protected virtual void Dispose(bool native) { if (_audiomixer != null) { _audiomixer.Stop(); _audiomixer.Dispose(); _audiomixer = null; } }
public static void DisposeAll() { Dispatcher.Dispose(); Display.Dispose(); Keyboard.Dispose(); Mouse.Dispose(); Touch.Dispose(); GamePad.Dispose(); Mixer.Dispose(); }
public void Length_Get_ShouldThrowException_WhenMixerDisposed() { // Arrange var mixer = new Mixer(); mixer.Dispose(); // Act // Assert Assert.That(() => mixer.Length, Throws.TypeOf <ObjectDisposedException>()); }
public void Read_ShouldThrowException_WhenMixerDisposed() { // Arrange var mixer = new Mixer(); mixer.Dispose(); // Act // Assert Assert.That(() => mixer.Read(new float[100], 0, 100), Throws.TypeOf <ObjectDisposedException>()); }
public void AddTrack_ShouldThrowException_WhenMixerDisposed() { // Arrange var mixer = new Mixer(); var sound = Substitute.For <ISampleSource>(); mixer.Dispose(); // Act // Assert Assert.That(() => mixer.AddTrack(sound), Throws.TypeOf <ObjectDisposedException>()); }
public void RemoveTrack_ShouldThrowException_WhenMixerDisposed() { // Arrange var mixer = new Mixer(); var soundData = GetRandomFloats(); var sound = new TestSampleSource(soundData); var track = mixer.AddTrack(sound); mixer.Dispose(); // Act // Assert Assert.That(() => mixer.RemoveTrack(track), Throws.TypeOf <ObjectDisposedException>()); }
private void mixers_SelectedIndexChanged(object sender, EventArgs e) { if (mixers.SelectedIndex == -1) { return; } if (mix != null) { mix.Dispose(); } mix = Mixer.OpenMixer((uint)mixers.SelectedIndex); mix.CreateEvents = true; destLines.Items.Clear(); foreach (DestinationLine dl in mix.DestinationLines) { destLines.Items.Add(dl.Name); } destLines_SelectedIndexChanged(this, e); }
public void Dispose_ShouldDisposeAllAddedSampleSources() { // Arrange var mixer = new Mixer(); var soundData = GetRandomFloats(); var sound1 = new TestSampleSource(soundData); var sound2 = new TestSampleSource(soundData); mixer.AddTrack(sound1); mixer.AddTrack(sound2); // Assume Assume.That(sound1.IsDisposed, Is.False); Assume.That(sound2.IsDisposed, Is.False); // Act mixer.Dispose(); // Assert Assert.That(sound1.IsDisposed, Is.True); Assert.That(sound2.IsDisposed, Is.True); }
/// <summary> /// On closing. /// </summary> private void OnClosing(object sender, EventArgs e) { Mixer.Dispose(); Player.Dispose(); }
// Clean on close private void Window_Closing_1(object sender, System.ComponentModel.CancelEventArgs e) { mixer.Dispose(); base.OnClosed(e); }
public void TearDown() { _mixer.Dispose(); }