Namespace: DeltaEngine.Multimedia
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Multimedia.Tests.SoundTests
6 unit tests call DeltaEngine.Multimedia.Sound.CreateSoundInstance
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Return Value
Type: SoundInstanceRemarks
Examples
[Test] public void PlaySoundRightAndPitched() { var sound = ContentLoader.Load<Sound>("DefaultSound"); var instance = sound.CreateSoundInstance(); instance.Panning = 1.0f; instance.Pitch = 2.0f; instance.Play(); }
[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); }
[Test] public void PlayMultipleSoundInstances() { var sound = ContentLoader.Load<Sound>("DefaultSound"); var instance1 = sound.CreateSoundInstance(); var instance2 = sound.CreateSoundInstance(); Assert.AreEqual(false, instance1.IsPlaying); instance1.Play(); Assert.AreEqual(true, instance1.IsPlaying); Assert.AreEqual(false, instance2.IsPlaying); instance2.Volume = 0.5f; instance2.Panning = -1.0f; instance2.Play(); Assert.AreEqual(true, instance2.IsPlaying); }
See Also