Class SoundManager
Manages all vehicle sound effects (engine, transmission, impacts, etc.). Handles 3D audio, volume mixing, and camera-based interior/exterior filtering.
Inherited Members
Namespace: NWH.VehiclePhysics2.Sound
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class SoundManager : ManagerVehicleComponent
Fields
airBrakeComponent
Air brake release sound.
Declaration
[Tooltip("Sound of air brakes releasing air. Supports multiple clips.")]
public AirBrakeComponent airBrakeComponent
Field Value
| Type | Description |
|---|---|
| AirBrakeComponent |
blinkerComponent
Turn signal tick-tock sound.
Declaration
[Tooltip("Tick-tock sound of a working blinker. First clip is played when blinker is turning on and second clip is played when blinker is turning off.")]
public BlinkerComponent blinkerComponent
Field Value
| Type | Description |
|---|---|
| BlinkerComponent |
crashComponent
Collision impact sound.
Declaration
[Tooltip("Sound of a vehicle hitting other objects. Supports multiple clips.")]
public CrashComponent crashComponent
Field Value
| Type | Description |
|---|---|
| CrashComponent |
crashSourceGO
Container for crash audio sources.
Declaration
[Tooltip("GameObject containing all the crash audio sources.")]
public GameObject crashSourceGO
Field Value
| Type | Description |
|---|---|
| GameObject |
dopplerLevel
Doppler effect intensity (0 = off, 1 = full).
Declaration
[Tooltip("Intensity of doppler effect on vehicle audio sources.")]
public float dopplerLevel
Field Value
| Type | Description |
|---|---|
| float |
engineFanComponent
Engine cooling fan sound.
Declaration
[Tooltip("Sound of the engine cooling fan. Can also be used to add additional sound layers to the engine instead.")]
public EngineFanComponent engineFanComponent
Field Value
| Type | Description |
|---|---|
| EngineFanComponent |
engineMixerGroup
Mixer group for all engine sounds.
Declaration
[Tooltip("Mixer group for all engine sounds.")]
public AudioMixerGroup engineMixerGroup
Field Value
| Type | Description |
|---|---|
| AudioMixerGroup |
engineRunningComponent
Granular engine audio synthesis across all RPMs.
Declaration
[Tooltip("Granular engine audio synthesis across all RPMs.")]
public EngineRunningComponent engineRunningComponent
Field Value
| Type | Description |
|---|---|
| EngineRunningComponent |
engineSourceGO
GameObject containing all the engine audio sources.
Declaration
[Tooltip("GameObject containing all the engine audio sources.")]
public GameObject engineSourceGO
Field Value
| Type | Description |
|---|---|
| GameObject |
engineStartStopComponent
Engine start / stop component. The first clip is for starting and the second one is for stopping.
Declaration
[Tooltip("Engine start / stop component. The first clip is for starting and the second one is for stopping.")]
public EngineStartStopComponent engineStartStopComponent
Field Value
| Type | Description |
|---|---|
| EngineStartStopComponent |
exhaustPopComponent
Sound of the engine popping on throttle release.
Declaration
[Tooltip("Sound of the engine popping on throttle release.")]
public ExhaustPopComponent exhaustPopComponent
Field Value
| Type | Description |
|---|---|
| ExhaustPopComponent |
exhaustSourceGO
GameObject containing all the exhaust audio sources.
Declaration
[Tooltip("GameObject containing all the exhaust audio sources.")]
public GameObject exhaustSourceGO
Field Value
| Type | Description |
|---|---|
| GameObject |
forcedInductionComponent
Forced induction whistle component. Can be used for air intake noise or supercharger if spool-up time is set to 0 under engine settings.
Declaration
[FormerlySerializedAs("turboWhistleComponent")]
[Tooltip("Forced induction whistle component. Can be used for air intake noise or supercharger if spool up time is set to 0 under engine settings.")]
public ForcedInductionComponent forcedInductionComponent
Field Value
| Type | Description |
|---|---|
| ForcedInductionComponent |
gearChangeComponent
Sound from changing gears. Supports multiple clips.
Declaration
[Tooltip("Sound from changing gears. Supports multiple clips.")]
public GearChangeComponent gearChangeComponent
Field Value
| Type | Description |
|---|---|
| GearChangeComponent |
hornComponent
Horn sound.
Declaration
[Tooltip("Horn sound.")]
public HornComponent hornComponent
Field Value
| Type | Description |
|---|---|
| HornComponent |
interiorAttenuation
Sound attenuation in decibels when camera is inside the vehicle. Negative values reduce volume. Applied when the active camera enters the vehicle.
Declaration
[Tooltip("Sound attenuation inside the vehicle.")]
public float interiorAttenuation
Field Value
| Type | Description |
|---|---|
| float |
lowPassFrequency
Low-pass filter cutoff frequency in Hz for interior audio. Frequencies above this value will be attenuated when camera is inside the vehicle. Lower values create a more muffled interior sound (typical range: 500-5000 Hz).
Declaration
[Tooltip("Frequencies above this frequency will be attenuated.")]
public float lowPassFrequency
Field Value
| Type | Description |
|---|---|
| float |
lowPassQ
Resonance quality factor of the low-pass filter. Determines how sharply frequencies drop off after the cutoff frequency. Lower values (0.1-1) create a gradual rolloff, higher values (1-10) create a sharper cutoff.
Declaration
[Range(0.01, 10)]
[Tooltip(" Determines the slope of the low pass filter, i.e. how fast the frequencies will drop off \r\n after the low pass frequency.")]
public float lowPassQ
Field Value
| Type | Description |
|---|---|
| float |
masterGroup
Main mixer group, affecting all other groups.
Declaration
[Tooltip("Main mixer group, affecting all other groups.")]
public AudioMixerGroup masterGroup
Field Value
| Type | Description |
|---|---|
| AudioMixerGroup |
masterVolume
Master volume multiplier for all sound components on this vehicle. Range of 0 to 2 allows for volume boost beyond 100%. To adjust volume globally across all vehicles, use the Audio Mixer instead.
Declaration
[Range(0, 2)]
[Tooltip(" Master volume of a vehicle. To adjust volume of all vehicles or their components check audio mixer.")]
public float masterVolume
Field Value
| Type | Description |
|---|---|
| float |
mixer
Optional custom mixer. If left empty, default will be used (VehicleAudioMixer in the Resources folder).
Declaration
[Tooltip(" Optional custom mixer. If left empty default will be used (VehicleAudioMixer in Resources folder).")]
public AudioMixer mixer
Field Value
| Type | Description |
|---|---|
| AudioMixer |
otherMixerGroup
Mixer group for misc sounds.
Declaration
[Tooltip("Mixer group for misc sounds.")]
public AudioMixerGroup otherMixerGroup
Field Value
| Type | Description |
|---|---|
| AudioMixerGroup |
otherSourceGO
GameObject containing all other audio sources.
Declaration
[Tooltip("GameObject containing all other audio sources.")]
public GameObject otherSourceGO
Field Value
| Type | Description |
|---|---|
| GameObject |
reverseBeepComponent
Reverse beep used as warning on most commercial vehicles.
Declaration
[Tooltip("Reverse beep used as warning on most commercial vehicles.")]
public ReverseBeepComponent reverseBeepComponent
Field Value
| Type | Description |
|---|---|
| ReverseBeepComponent |
spatialBlend
Spatial blend of all audio sources between 2D (0) and 3D (1). Higher values increase positional audio effect. Cannot be changed at runtime.
Declaration
[Range(0, 1)]
[Tooltip("Spatial blend of all audio sources. Cannot be changed at runtime.")]
public float spatialBlend
Field Value
| Type | Description |
|---|---|
| float |
surfaceNoiseMixerGroup
Mixer group for sounds caused by wheel interaction with the surface.
Declaration
[Tooltip("Mixer group for sounds caused by wheel interaction with the surface.")]
public AudioMixerGroup surfaceNoiseMixerGroup
Field Value
| Type | Description |
|---|---|
| AudioMixerGroup |
suspensionBumpComponent
Sound from wheels hitting ground and/or obstacles. Supports multiple clips.
Declaration
[Tooltip("Sound from wheels hitting ground and/or obstacles. Supports multiple clips.")]
public SuspensionBumpComponent suspensionBumpComponent
Field Value
| Type | Description |
|---|---|
| SuspensionBumpComponent |
transmissionMixerGroup
Mixer group for everything related to the transmission.
Declaration
[Tooltip("Mixer group for everything related to the transmission.")]
public AudioMixerGroup transmissionMixerGroup
Field Value
| Type | Description |
|---|---|
| AudioMixerGroup |
transmissionSourceGO
GameObject containing all transmission audio sources.
Declaration
[Tooltip("GameObject containing all transmission audio sources.")]
public GameObject transmissionSourceGO
Field Value
| Type | Description |
|---|---|
| GameObject |
transmissionWhineComponent
Transmission whine from straight cut gears or just a noisy gearbox.
Declaration
[Tooltip("Transmission whine from straight cut gears or just a noisy gearbox.")]
public TransmissionWhineComponent transmissionWhineComponent
Field Value
| Type | Description |
|---|---|
| TransmissionWhineComponent |
turboFlutterComponent
Sound of turbo's wastegate. Supports multiple clips.
Declaration
[Tooltip("Sound of turbo's wastegate. Supports multiple clips.")]
public TurboFlutterComponent turboFlutterComponent
Field Value
| Type | Description |
|---|---|
| TurboFlutterComponent |
wheelSkidComponent
Sound produced by a wheel skidding over a surface. Tire squeal.
Declaration
[Tooltip("Sound produced by a wheel skidding over a surface. Tire squeal.")]
public WheelSkidComponent wheelSkidComponent
Field Value
| Type | Description |
|---|---|
| WheelSkidComponent |
wheelTireNoiseComponent
Sound produced by a wheel rolling over a surface. Tire hum.
Declaration
[Tooltip("Sound produced by a wheel rolling over a surface. Tire hum.")]
public WheelTireNoiseComponent wheelTireNoiseComponent
Field Value
| Type | Description |
|---|---|
| WheelTireNoiseComponent |
Methods
CreateSourceGO(string, Vector3, Transform, ref GameObject)
Creates a GameObject container for audio sources at the specified position. Used internally to organize positional audio sources by category.
Declaration
public void CreateSourceGO(string name, Vector3 localPosition, Transform parent, ref GameObject sourceGO)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the container GameObject. |
| Vector3 | localPosition | Local position relative to the parent transform. |
| Transform | parent | Parent transform to attach the container to. |
| GameObject | sourceGO | Reference to store the created GameObject. |
FillComponentList()
Override to populate _components with your child components. Called lazily on first Components access.
Declaration
protected override void FillComponentList()
Overrides
RegisterExternalSoundComponent(SoundComponent)
Registers an external sound component with the manager. Initializes the component, loads its state, and adds it to the component list. Use this to add custom sound components at runtime.
Declaration
public void RegisterExternalSoundComponent(SoundComponent component)
Parameters
| Type | Name | Description |
|---|---|---|
| SoundComponent | component | The sound component to register. |
VC_Disable(bool)
Disables manager and all children (with calledByParent=true).
Declaration
public override bool VC_Disable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_Enable(bool)
Enables manager and all children (with calledByParent=true).
Declaration
public override bool VC_Enable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_Initialize()
Initializes the component's internal systems and resources. Called once during vehicle startup after the VehicleController reference is set.
Declaration
protected override void VC_Initialize()
Overrides
Remarks
Override this to set up component-specific resources, cache references, or perform one-time initialization. Sets state.initialized to true on completion.
VC_SetDefaults()
Sets defaults to all the basic sound components when the script is first added or reset is called.
Declaration
public override void VC_SetDefaults()