Sound Class
Namespace: Stride.AudioAssembly: Stride.Audio.dll
Sound content.
Derived from Sound:
[ContentSerializer(typeof(DataContentSerializer<Sound>))]
[DataSerializerGlobal(typeof(ReferenceSerializer<Sound>), null, DataSerializerGenericMode.None, false, false, Profile = "Content")]
[DataSerializer(typeof(SoundSerializer))]
public sealed class Sound : SoundBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Remarks
Sound is played with a SoundInstance.
| Name | Description | |
|---|---|---|
| Methods | ||
| CreateInstance(AudioListener, Boolean, Boolean, Single, HrtfEnvironment) | Create a new sound effect instance of the sound effect. The audio data are shared between the instances so that useless memory copies is avoided. Each instance that can be played and localized independently from others. |
|
| CreateInstance(AudioListener, Boolean, Single, HrtfEnvironment) | ||
| Destroy() | ||
Methods
CreateInstance(AudioListener, Boolean, Boolean, Single, HrtfEnvironment)
Create a new sound effect instance of the sound effect. The audio data are shared between the instances so that useless memory copies is avoided. Each instance that can be played and localized independently from others.
public SoundInstance CreateInstance(AudioListener listener = null, bool forceLoadInMemory = false, bool useHrtf = false, float directionalFactor = 0F, HrtfEnvironment environment = HrtfEnvironment.Small)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioListener | listener | |
| System.Boolean | forceLoadInMemory | |
| System.Boolean | useHrtf | |
| System.Single | directionalFactor | |
| HrtfEnvironment | environment |
Returns
| Type | Description |
|---|---|
| SoundInstance | A new sound instance |
Exceptions
| Type | Condition |
|---|---|
| System.ObjectDisposedException | The sound has already been disposed |
CreateInstance(AudioListener, Boolean, Single, HrtfEnvironment)
public override SoundInstance CreateInstance(AudioListener listener = null, bool useHrtf = false, float directionalFactor = 0F, HrtfEnvironment environment = HrtfEnvironment.Small)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioListener | listener | |
| System.Boolean | useHrtf | |
| System.Single | directionalFactor | |
| HrtfEnvironment | environment |
Returns
| Type | Description |
|---|---|
| SoundInstance |
Overrides
Destroy()
protected override void Destroy()