NWH Aerodynamics
Search Results for

    Show / Hide Table of Contents

    Class AircraftSoundComponentBehaviour

    Base class for all vehicle SoundComponents. Inserts a layer above Unity's AudioSource(s) which insures that the values are set properly, master volume is used, etc. Supports multiple AudioSources/AudioClips per one SoundComponent for random clip switching.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    AircraftSoundComponentBehaviour
    CrashAircraftSoundComponent
    EngineRunningAircraftSoundComponent
    EngineStartingAircraftSoundComponent
    WindAircraftSoundComponent
    Namespace: NWH.Aerodynamics.AircraftController.Sound
    Assembly: NWH.Aerodynamics.dll
    Syntax
    [Serializable]
    public abstract class AircraftSoundComponentBehaviour : MonoBehaviour

    Fields

    | Edit this page View Source

    aircraftController

    Declaration
    protected AircraftController aircraftController
    Field Value
    Type Description
    AircraftController
    | Edit this page View Source

    audioMixerGroup

    AudioMixerGroup that this SoundComponent belongs to.

    Declaration
    [Tooltip("AudioMixerGroup that this SoundComponent belongs to.")]
    public AudioMixerGroup audioMixerGroup
    Field Value
    Type Description
    AudioMixerGroup
    | Edit this page View Source

    basePitch

    Base pitch of the sound component.

    Declaration
    [FormerlySerializedAs("pitch")]
    [Range(0, 2)]
    [Tooltip("Base pitch of the sound component.")]
    public float basePitch
    Field Value
    Type Description
    float
    | Edit this page View Source

    baseVolume

    Base volume of the sound component.

    Declaration
    [FormerlySerializedAs("volume")]
    [Range(0, 1)]
    [Tooltip("Base volume of the sound component.")]
    public float baseVolume
    Field Value
    Type Description
    float
    | Edit this page View Source

    clips

    List of audio clips this component can use. Some components can use multiple clips in which case they will be chosen at random, and some components can use only one in which case only the first clip will be selected. Check manual for more details.

    Declaration
    [Tooltip("List of audio clips this component can use. Some components can use multiple clips in which case they will be chosen at random, and some components can use only one in which case only the first clip will be selected. Check manual for more details.")]
    public List<AudioClip> clips
    Field Value
    Type Description
    List<AudioClip>
    | Edit this page View Source

    container

    Container to which this SoundComponent belongs to. All AudioSources will be attached to this object.

    Declaration
    [Tooltip("Container to which this SoundComponent belongs to. All AudioSources will be attached to this object.")]
    public GameObject container
    Field Value
    Type Description
    GameObject
    | Edit this page View Source

    mixer

    Declaration
    protected AudioMixer mixer
    Field Value
    Type Description
    AudioMixer
    | Edit this page View Source

    sources

    Declaration
    [NonSerialized]
    protected List<AudioSource> sources
    Field Value
    Type Description
    List<AudioSource>

    Properties

    | Edit this page View Source

    Clip

    Gets or sets the first clip in the clips list.

    Declaration
    public AudioClip Clip { get; set; }
    Property Value
    Type Description
    AudioClip
    | Edit this page View Source

    Clips

    Gets or sets the whole clip list.

    Declaration
    public List<AudioClip> Clips { get; set; }
    Property Value
    Type Description
    List<AudioClip>
    | Edit this page View Source

    RandomClip

    Gets a random clip from clips list.

    Declaration
    public AudioClip RandomClip { get; }
    Property Value
    Type Description
    AudioClip
    | Edit this page View Source

    Source

    Gets or sets the first audio source in the sources list.

    Declaration
    public AudioSource Source { get; set; }
    Property Value
    Type Description
    AudioSource
    | Edit this page View Source

    Sources

    AudioSources belonging to this SoundComponent.

    Declaration
    public List<AudioSource> Sources { get; set; }
    Property Value
    Type Description
    List<AudioSource>

    Methods

    | Edit this page View Source

    AddSourcesToMixer()

    Adds outputs of sources to the mixer.

    Declaration
    public void AddSourcesToMixer()
    | Edit this page View Source

    Awake()

    Declaration
    public virtual void Awake()
    | Edit this page View Source

    Disable()

    Disables all the AudioSources belonging to this SoundComponent. Will call Stop() as well as disable the source.

    Declaration
    public void Disable()
    | Edit this page View Source

    Enable()

    Enables all the AudioSources belonging to this SoundComponent. Calls Play() on all the looping sources.

    Declaration
    public void Enable()
    | Edit this page View Source

    GetDefaultClipName()

    Declaration
    public virtual string GetDefaultClipName()
    Returns
    Type Description
    string
    | Edit this page View Source

    GetMixerGroupName()

    Declaration
    public virtual string GetMixerGroupName()
    Returns
    Type Description
    string
    | Edit this page View Source

    GetPitch()

    Gets pitch of the Source. Equal to Source.pitch.

    Declaration
    public float GetPitch()
    Returns
    Type Description
    float
    | Edit this page View Source

    GetVolume()

    Gets volume of the Source. Equal to Source.volume.

    Declaration
    public float GetVolume()
    Returns
    Type Description
    float
    | Edit this page View Source

    Initialize(bool, bool)

    Initializes the sound component by creating and configuring the audio source.

    Declaration
    public virtual void Initialize(bool play, bool loop)
    Parameters
    Type Name Description
    bool play

    Whether to start playing immediately.

    bool loop

    Whether the audio should loop.

    | Edit this page View Source

    LoadDefaultAudioMixer()

    Declaration
    public static AudioMixer LoadDefaultAudioMixer()
    Returns
    Type Description
    AudioMixer
    | Edit this page View Source

    LoopOnAwake()

    Declaration
    public virtual bool LoopOnAwake()
    Returns
    Type Description
    bool
    | Edit this page View Source

    Play()

    Plays the source if it is not already playing.

    Declaration
    public void Play()
    | Edit this page View Source

    Play(int)

    Plays the source at index if not already playing.

    Declaration
    public void Play(int index)
    Parameters
    Type Name Description
    int index

    Index of the source to play.

    | Edit this page View Source

    PlayOnAwake()

    Declaration
    public virtual bool PlayOnAwake()
    Returns
    Type Description
    bool
    | Edit this page View Source

    Reset()

    Declaration
    public virtual void Reset()
    | Edit this page View Source

    SetAudioSourceDefaults(AudioSource, bool, bool, float, AudioClip)

    Initializes audio source to it's starting values.

    Declaration
    public void SetAudioSourceDefaults(AudioSource audioSource, bool play = false, bool loop = false, float volume = 0, AudioClip clip = null)
    Parameters
    Type Name Description
    AudioSource audioSource

    AudioSource in question.

    bool play

    Play on awake?

    bool loop

    Should clip be looped?

    float volume

    Volume of the audio source.

    AudioClip clip

    Clip that will be set at the start.

    | Edit this page View Source

    SetPitch(float)

    Sets pitch for the first source in sources list.

    Declaration
    public void SetPitch(float pitch)
    Parameters
    Type Name Description
    float pitch

    Pitch to set.

    | Edit this page View Source

    SetPitch(float, int)

    Sets pitch for the [id]th source in sources list.

    Declaration
    public void SetPitch(float pitch, int index)
    Parameters
    Type Name Description
    float pitch

    Pitch to set.

    int index

    Index of the source.

    | Edit this page View Source

    SetVolume(float)

    Sets volume for the first source in sources list. Use instead of directly changing source volume as this takes master volume into account.

    Declaration
    public void SetVolume(float volume)
    Parameters
    Type Name Description
    float volume

    Volume to set.

    | Edit this page View Source

    SetVolume(float, int)

    Sets volume for the [id]th source in sources list. Use instead of directly changing source volume as this takes master volume into account.

    Declaration
    public void SetVolume(float volume, int index)
    Parameters
    Type Name Description
    float volume

    Volume to set.

    int index

    Index of the target source.

    | Edit this page View Source

    SetVolume(float, AudioSource)

    Sets the volume of AudioSource. Takes master volume into account.

    Declaration
    public void SetVolume(float volume, AudioSource source)
    Parameters
    Type Name Description
    float volume

    Volume to set.

    AudioSource source

    Target AudioSource.

    | Edit this page View Source

    Stop()

    Stops the AudioSource if already playing.

    Declaration
    public void Stop()
    | Edit this page View Source

    Stop(int)

    Stops the AudioSource at index if already playing.

    Declaration
    public void Stop(int index)
    Parameters
    Type Name Description
    int index

    Target AudioSource index.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics