SoundBase Class
Namespace: Stride.AudioAssembly: Stride.Audio.dll
Base class for a Sound content.
public abstract class SoundBase : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Remarks
Sound is played with a SoundInstance.
Name | Description | |
---|---|---|
Fields | ||
intancesCreationCount | The number of Instances Created so far by this SoundEffect. Used only to give a unique name to the SoundEffectInstance. |
|
Properties | ||
TotalLength | Gets the total length in time of the Sound. |
|
Methods | ||
CreateInstance(AudioListener, Boolean, Single, HrtfEnvironment) | Create a new sound effect instance of the sound effect. Each instance that can be played and localized independently from others. |
|
Destroy() | Destroys the instance. |
|
GetCountChannels() | ||
RegisterInstance(SoundInstance) | Register a new instance to the soundEffect. |
Fields
intancesCreationCount
The number of Instances Created so far by this SoundEffect. Used only to give a unique name to the SoundEffectInstance.
protected int intancesCreationCount
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
TotalLength
Gets the total length in time of the Sound.
public TimeSpan TotalLength { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Methods
CreateInstance(AudioListener, Boolean, Single, HrtfEnvironment)
Create a new sound effect instance of the sound effect. Each instance that can be played and localized independently from others.
public abstract 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 | A new sound instance |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The sound has already been disposed |
Destroy()
Destroys the instance.
protected override void Destroy()
Overrides
GetCountChannels()
public int GetCountChannels()
Returns
Type | Description |
---|---|
System.Int32 |
RegisterInstance(SoundInstance)
Register a new instance to the soundEffect.
protected void RegisterInstance(SoundInstance instance)
Parameters
Type | Name | Description |
---|---|---|
SoundInstance | instance | new instance to register. |