Sound ClassDelta Engine Documentation
Provides a way to load and play simple sound effects by creating a SoundInstance per play. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content ContentData
    DeltaEngine.Multimedia Sound
      DeltaEngine.Content.Mocks MockSound
      DeltaEngine.Multimedia.BaseOpenAL OpenALSound
      DeltaEngine.Multimedia.SharpDX XAudioSound
      DeltaEngine.Multimedia.SlimDX XAudioSound
      DeltaEngine.Multimedia.Xna XnaSound

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

public abstract class Sound : ContentData

The Sound type exposes the following members.

Constructors

  NameDescription
Protected methodSound
Initializes a new instance of the Sound class
Top
Methods

  NameDescription
Protected methodCreateChannel
Protected methodCreateDefault (Inherited from ContentData.)
Public methodCreateSoundInstance
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Overrides ContentData DisposeData .)
Public methodInternalCreateDefault (Inherited from ContentData.)
Public methodIsPlaying
Protected methodLoadData (Inherited from ContentData.)
Public methodPlay 
Public methodPlay(Single, Single)
Public methodPlayInstance
Protected methodRemoveChannel
Public methodStopAll
Public methodStopInstance
Public methodToString (Inherited from ContentData.)
Top
Fields

  NameDescription
Protected fieldContentChanged (Inherited from ContentData.)
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Overrides ContentData AllowCreationIfContentNotFound.)
Public propertyIsAnyInstancePlaying
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyLengthInSeconds
Public propertyMetaData (Inherited from ContentData.)
Public propertyName (Inherited from ContentData.)
Public propertyNumberOfInstances
Public propertyNumberOfPlayingInstances
Top
Events

  NameDescription
Public eventOnPlay
Public eventOnStop
Top
Remarks

Tests: DeltaEngine.Multimedia.Tests.SoundDeviceTests
Examples

25 unit tests call DeltaEngine.Multimedia.Sound
[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 RunWithVideoAndMusic()
{
    var video = ContentLoader.Load<Video>("DefaultVideo");
    var music = ContentLoader.Load<Music>("DefaultMusic");
    video.Play();
    music.Play();
}
[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);
}
See Also