SoundDevice Dispose Method Delta Engine Documentation

Namespace: DeltaEngine.Multimedia
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public override void Dispose()

Implements

IDisposable Dispose 
Remarks

Tests: DeltaEngine.Multimedia.Tests.SoundDeviceTests
Examples

3 unit tests call DeltaEngine.Multimedia.SoundDevice.Dispose
[Test, CloseAfterFirstFrame]
public void PlayMusicAndVideo()
{
    var device = new MockSoundDevice();
    Assert.IsTrue(device.IsInitialized);
    var music = ContentLoader.Load<Music>("DefaultMusic");
    var video = ContentLoader.Load<Video>("DefaultVideo");
    music.Play();
    video.Play();
    Assert.False(MockMusic.MusicStopCalled);
    Assert.False(MockVideo.VideoStopCalled);
    device.RegisterCurrentMusic(music);
    device.RegisterCurrentVideo(video);
    Assert.IsTrue(device.IsActive);
    Assert.IsTrue(device.IsInitialized);
    device.RapidUpdate();
    device.Dispose();
}
[Test, CloseAfterFirstFrame]
public void PlayAndStopMusic()
{
    var device = new MockSoundDevice();
    Assert.IsFalse(device.IsPauseable);
    Assert.IsTrue(device.IsInitialized);
    var musicTime = ContentLoader.Load<Music>("DefaultMusic");
    musicTime.StreamFinished = () => { };
    musicTime.Play();
    Assert.AreEqual(Settings.Current.MusicVolume, musicTime.Volume);
    device.RegisterCurrentMusic(musicTime);
    musicTime.Stop();
    device.RapidUpdate();
    musicTime.Loop = true;
    musicTime.Stop();
    device.RapidUpdate();
    device.Dispose();
}
[Test, CloseAfterFirstFrame]
public void ChangeMusicVolume()
{
    var device = new MockSoundDevice();
    float defaultMusicVolume = Settings.Current.MusicVolume;
    Assert.IsTrue(device.IsInitialized);
    try
    {
        device.MusicVolume = 1.0f;
        Assert.AreEqual(1.0f, device.MusicVolume);
    }
    finally
    {
        device.MusicVolume = defaultMusicVolume;
    }
    device.RapidUpdate();
    device.Dispose();
}
See Also