AudioEmitterComponent Class
Namespace: Stride.EngineAssembly: Stride.Engine.dll
Component representing an audio emitter.
[Display("Audio emitter", null, Expand = ExpandRule.Once)]
[DataContract("AudioEmitterComponent")]
[DefaultEntityComponentProcessor(typeof(AudioEmitterProcessor), ExecutionMode = ExecutionMode.Runtime)]
[ComponentOrder(7000)]
[ComponentCategory("Audio")]
public sealed class AudioEmitterComponent : ActivableEntityComponent, IIdentifiable
Remarks
Associate this component to an entity to simulate a 3D localized source of sound coming from the entity center.
Several sounds can be associated to a single AudioEmitterComponent.
Use the Sounds dictionary to associate or dissociate a SoundBase to the emitter component.
Each SoundBase associated to the emitter component can be controlled (played, paused, stopped, ...) independently for the others.
Once attached to the emitter component, a SoundBase is controlled using a AudioEmitterSoundController.
To get the AudioEmitterSoundController associated to a SoundBase use the readonly
Name | Description | |
---|---|---|
Fields | ||
Sounds | The sounds this audio emitter can play and use |
|
Properties | ||
DirectionalFactor | If 0 the sound will be omnidirectional, 1 fully directional |
|
Environment | The reverberation model that this emitter will use |
|
Item[String] | The sound controllers associated with the sounds this audio emitter can play and use, use this to access and play sounds. |
|
UseHRTF | If possible use a more complex HRTF algorithm to perform 3D sound simulation |
|
Methods | ||
AttachSound(SoundBase) | Attach a SoundBase to this emitter component.
Once attached a AudioEmitterSoundController can be queried using readonly |
|
DetachSound(SoundBase) | Detach a SoundBase from this emitter component. Once detach the controller previously associated to the SoundBase is invalid. |
Fields
Sounds
The sounds this audio emitter can play and use
[DataMember(10)]
public TrackingDictionary<string, Sound> Sounds
Field Value
Type | Description |
---|---|
TrackingDictionary<System.String, Sound> |
Properties
DirectionalFactor
If 0 the sound will be omnidirectional, 1 fully directional
[DataMember(30)]
[DataMemberRange(0, 1, 0.1, 0.2, 3)]
public float DirectionalFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Environment
The reverberation model that this emitter will use
[DataMember(40)]
public HrtfEnvironment Environment { get; set; }
Property Value
Type | Description |
---|---|
HrtfEnvironment |
Item[String]
The sound controllers associated with the sounds this audio emitter can play and use, use this to access and play sounds.
public AudioEmitterSoundController this[string soundName] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | soundName | The name of the sound you want to access. |
Property Value
Type | Description |
---|---|
AudioEmitterSoundController | The sound controller. |
UseHRTF
If possible use a more complex HRTF algorithm to perform 3D sound simulation
[DataMember(20)]
public bool UseHRTF { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
AttachSound(SoundBase)
Attach a SoundBase to this emitter component.
Once attached a AudioEmitterSoundController can be queried using readonly
public AudioEmitterSoundController AttachSound(SoundBase sound)
Parameters
Type | Name | Description |
---|---|---|
SoundBase | sound | The SoundBase to attach |
Returns
Type | Description |
---|---|
AudioEmitterSoundController |
Remarks
Attaching a SoundBase already attached has no effects.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The provided |
System.InvalidOperationException | The provided |
DetachSound(SoundBase)
Detach a SoundBase from this emitter component. Once detach the controller previously associated to the SoundBase is invalid.
public void DetachSound(SoundBase sound)
Parameters
Type | Name | Description |
---|---|---|
SoundBase | sound | The SoundBase to detach. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The provided |
System.ArgumentException | The provided |