Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    AudioEmitterComponent Class

    Namespace: Stride.Engine
    Assembly: Stride.Engine.dll

    Component representing an audio emitter.

    System.Object → EntityComponent → ActivableEntityComponent → AudioEmitterComponent
    Derived from AudioEmitterComponent:

    [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 indexer.

    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 indexer to control the attached SoundBase.

    DetachSound(SoundBase)

    Detach a SoundBase from this emitter component. Once detach the controller previously associated to the SoundBase is invalid.

    | Improve this Doc View Source

    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>
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    Methods


    AttachSound(SoundBase)

    Attach a SoundBase to this emitter component. Once attached a AudioEmitterSoundController can be queried using readonly indexer to control the attached SoundBase.

    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 sound is null.

    System.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
    Type Name Description
    SoundBase sound

    The SoundBase to detach.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The provided sound is null.

    System.ArgumentException

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


    Inherited Members

    ActivableEntityComponent.Enabled
    EntityComponent.Entity
    EntityComponent.Id
    EntityComponent.EnsureEntity

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation