SoundTests PlayAndStopInstance Method Delta Engine Documentation

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

public void PlayAndStopInstance()
Examples

[Test]
public void PlayAndStopInstance()
{
    var sound = ContentLoader.Load<Sound>("DefaultSound");
    var instance = sound.CreateSoundInstance();
    Assert.IsFalse(sound.IsAnyInstancePlaying);
    Assert.AreEqual(0f, instance.PositionInSeconds);
    instance.Play();
    Assert.IsTrue(sound.IsAnyInstancePlaying);
    WaitUntilSoundStateIsUpdated();
    Assert.Greater(instance.PositionInSeconds, 0f);
    sound.StopAll();
    WaitUntilSoundStateIsUpdated();
    Assert.AreEqual(0f, instance.PositionInSeconds);
    Assert.IsFalse(sound.IsAnyInstancePlaying);
}
See Also