Sound IsPlaying Method Delta Engine Documentation

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

public abstract bool IsPlaying(
	SoundInstance instance
)

Return Value

Type: Boolean
Remarks

Tests: DeltaEngine.Multimedia.Tests.SoundDeviceTests
Examples

4 unit tests call DeltaEngine.Multimedia.Sound.IsPlaying(DeltaEngine.Multimedia.SoundInstance)
[Test]
public void PlayMusicWhileOtherIsPlaying()
{
    var music1 = ContentLoader.Load<Music>("DefaultMusic");
    var music2 = ContentLoader.Load<Music>("DefaultMusicBackwards");
    music1.Play();
    if (IsMockResolver)
        Assert.False(MockMusic.MusicStopCalled);
    music2.Play();
    if (IsMockResolver)
        Assert.True(MockMusic.MusicStopCalled);
}
[Test]
public void TestIfPLayingMusic()
{
    var video = ContentLoader.Load<Video>("DefaultVideo");
    video.Play();
    Assert.IsTrue(video.IsPlaying());
    Assert.AreEqual(3.33333325f, video.DurationInSeconds);
    Assert.AreEqual(1.0f, video.PositionInSeconds);
}
[Test]
public void PlaySoundInstance()
{
    var sound = ContentLoader.Load<Sound>("DefaultSound");
    var instance = sound.CreateSoundInstance();
    Assert.AreEqual(0.48f, sound.LengthInSeconds, 0.01f);
    Assert.AreEqual(false, instance.IsPlaying);
    instance.Play();
    Assert.AreEqual(true, instance.IsPlaying);
}
See Also