SoundTests NumberOfPlayingInstances 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 NumberOfPlayingInstances()
Examples

[Test]
public void NumberOfPlayingInstances()
{
    var sound = ContentLoader.Load<Sound>("DefaultSound");
    Assert.AreEqual(0, sound.NumberOfPlayingInstances);
    sound.Play();
    Assert.AreEqual(1, sound.NumberOfPlayingInstances);
    sound.Play();
    Assert.AreEqual(2, sound.NumberOfPlayingInstances);
}
[Test]
public void DisposeSoundInstance()
{
    var sound = ContentLoader.Load<Sound>("DefaultSound");
    var instance = sound.CreateSoundInstance();
    Assert.AreEqual(1, sound.NumberOfInstances);
    Assert.AreEqual(0, sound.NumberOfPlayingInstances);
    instance.Dispose();
    Assert.AreEqual(0, sound.NumberOfInstances);
    Assert.AreEqual(0, sound.NumberOfPlayingInstances);
}
[Test]
public void DisposeSoundInstancesFromSoundClass()
{
    var sound = ContentLoader.Load<Sound>("DefaultSound");
    sound.CreateSoundInstance();
    sound.Play();
    Assert.AreEqual(2, sound.NumberOfInstances);
    Assert.AreEqual(1, sound.NumberOfPlayingInstances);
    sound.Dispose();
    Assert.AreEqual(0, sound.NumberOfInstances);
    Assert.AreEqual(0, sound.NumberOfPlayingInstances);
}
See Also