Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    IPositionableSound Interface

    Namespace: Stride.Audio
    Assembly: Stride.Audio.dll

    Interface for 3D localizable sound. The interface currently supports only mono and stereo sounds (ref Pan). The user can localize its sound with Apply3D(AudioEmitter) by creating one AudioEmitter and one AudioListener respectly corresponding to the source of the sound and the listener. The Pan function enable the user to change the distribution of sound between the left and right speakers.

    public interface IPositionableSound : IPlayableSound
    Remarks

    Functions Pan and Apply3D(AudioEmitter) cannot be used together. A call to Apply3D(AudioEmitter) will reset Pan to its default value and inverse.

    Name Description
    Properties
    Pan

    Set the sound balance between left and right speaker.

    Pitch

    Gets or sets the pitch of the sound, might conflict with spatialized sound spatialization.

    Methods
    Apply3D(AudioEmitter)

    Applies 3D positioning to the sound. More precisely adjust the channel volumes and pitch of the sound, such that the sound source seems to come from the emitter to the listener/>.

    | Improve this Doc View Source

    Properties


    Pan

    Set the sound balance between left and right speaker.

    float Pan { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    Panning is ranging from -1.0f (full left) to 1.0f (full right). 0.0f is centered. Values beyond this range are clamped. Panning modifies the total energy of the signal (Pan == -1 => Energy = 1 + 0, Pan == 0 => Energy = 1 + 1, Pan == 0.5 => Energy = 1 + 0.5, ...)

    A call to Pan cancels the effect of Apply3D.


    Pitch

    Gets or sets the pitch of the sound, might conflict with spatialized sound spatialization.

    float Pitch { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Methods


    Apply3D(AudioEmitter)

    Applies 3D positioning to the sound. More precisely adjust the channel volumes and pitch of the sound, such that the sound source seems to come from the emitter to the listener/>.

    void Apply3D(AudioEmitter emitter)
    Parameters
    Type Name Description
    AudioEmitter emitter

    The emitter that correspond to this sound

    Remarks

    Apply3D(AudioEmitter) can be used only on mono-sounds.

    A call to Apply3D(AudioEmitter) reset Pan to its default values.

    A call to Apply3D(AudioEmitter) does not modify the value of Volume, the effective volume of the sound is a combination of the two effects.

    The final resulting pitch depends on the listener and emitter relative velocity. The final resulting channel volumes depend on the listener and emitter relative positions and the value of Volume.


    Inherited Members

    IPlayableSound.PlayState
    IPlayableSound.IsLooping
    IPlayableSound.Play()
    IPlayableSound.Pause()
    IPlayableSound.Stop()
    IPlayableSound.Volume

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)

    See Also

    Sound
    SoundInstance
    • Improve this Doc
    • View Source
    In This Article

    Back to top

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