Table of Contents

Class AudioEmitterComponent

Namespace
Stride.Engine
Assembly
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
Inheritance
AudioEmitterComponent
Implements
Inherited Members

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 AudioEmitterComponent.Item(string) indexer.

Fields

Sounds

The sounds this audio emitter can play and use

[DataMember(10)]
public TrackingDictionary<string, Sound> Sounds

Field Value

TrackingDictionary<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

float

Environment

The reverberation model that this emitter will use

[DataMember(40)]
public HrtfEnvironment Environment { get; set; }

Property Value

HrtfEnvironment

this[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

soundName string

The name of the sound you want to access.

Property Value

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

bool

Methods

AttachSound(SoundBase)

Attach a SoundBase to this emitter component. Once attached a AudioEmitterSoundController can be queried using readonly AudioEmitterComponent.Item(string) indexer to control the attached SoundBase.

public AudioEmitterSoundController AttachSound(SoundBase sound)

Parameters

sound SoundBase

The SoundBase to attach

Returns

AudioEmitterSoundController

Remarks

Attaching a SoundBase already attached has no effects.

Exceptions

ArgumentNullException

The provided sound is null.

InvalidOperationException

The provided sound can not be localized (contains more than one channel).

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

sound SoundBase

The SoundBase to detach.

Exceptions

ArgumentNullException

The provided sound is null.

ArgumentException

The provided sound is not currently attached to the emitter component.