예제 #1
0
        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;
        }
예제 #2
0
 protected virtual void Dispose(bool native)
 {
     if (_audiomixer != null)
     {
         _audiomixer.Stop();
         _audiomixer.Dispose();
         _audiomixer = null;
     }
 }
예제 #3
0
 public static void DisposeAll()
 {
     Dispatcher.Dispose();
     Display.Dispose();
     Keyboard.Dispose();
     Mouse.Dispose();
     Touch.Dispose();
     GamePad.Dispose();
     Mixer.Dispose();
 }
예제 #4
0
        public void Length_Get_ShouldThrowException_WhenMixerDisposed()
        {
            // Arrange
            var mixer = new Mixer();

            mixer.Dispose();

            // Act
            // Assert
            Assert.That(() => mixer.Length, Throws.TypeOf <ObjectDisposedException>());
        }
예제 #5
0
        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>());
        }
예제 #6
0
        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>());
        }
예제 #7
0
        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>());
        }
예제 #8
0
 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);
 }
예제 #9
0
        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);
        }
예제 #10
0
 /// <summary>
 /// On closing.
 /// </summary>
 private void OnClosing(object sender, EventArgs e)
 {
     Mixer.Dispose();
     Player.Dispose();
 }
예제 #11
0
 // Clean on close
 private void Window_Closing_1(object sender, System.ComponentModel.CancelEventArgs e)
 {
     mixer.Dispose();
     base.OnClosed(e);
 }
예제 #12
0
 public void TearDown()
 {
     _mixer.Dispose();
 }