Provides a way to load and play simple sound effects by creating a SoundInstance per play.
View code on GitHub
Inheritance Hierarchy
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
The Sound type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Sound | Initializes a new instance of the Sound class |
Methods
Name | Description | |
---|---|---|
CreateChannel | ||
CreateDefault | (Inherited from ContentData.) | |
CreateSoundInstance | ||
Dispose | (Inherited from ContentData.) | |
DisposeData | (Overrides ContentData DisposeData .) | |
InternalCreateDefault | (Inherited from ContentData.) | |
IsPlaying | ||
LoadData | (Inherited from ContentData.) | |
Play | ||
Play(Single, Single) | ||
PlayInstance | ||
RemoveChannel | ||
StopAll | ||
StopInstance | ||
ToString | (Inherited from ContentData.) |
Fields
Name | Description | |
---|---|---|
ContentChanged | (Inherited from ContentData.) |
Properties
Name | Description | |
---|---|---|
AllowCreationIfContentNotFound | (Overrides ContentData AllowCreationIfContentNotFound.) | |
IsAnyInstancePlaying | ||
IsDisposed | (Inherited from ContentData.) | |
LengthInSeconds | ||
MetaData | (Inherited from ContentData.) | |
Name | (Inherited from ContentData.) | |
NumberOfInstances | ||
NumberOfPlayingInstances |
Events
Name | Description | |
---|---|---|
OnPlay | ||
OnStop |
Remarks
Examples
[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