Class EngineRunningComponent
Granular engine audio synthesis using per-vehicle AudioSources. Crossfades multiple RPM samples and controls source-local lowpass, distortion, and dry-level gain.
Inherited Members
Namespace: NWH.VehiclePhysics2.Sound.SoundComponents
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class EngineRunningComponent : SoundComponent
Fields
crossfadeCurve
Volume falloff curve for crossfading between RPM samples.
Declaration
public AnimationCurve crossfadeCurve
Field Value
| Type | Description |
|---|---|
| AnimationCurve |
dopplerLevel
Doppler amount applied to the granular engine sources.
Declaration
public float dopplerLevel
Field Value
| Type | Description |
|---|---|
| float |
engineSamples
RPM-based audio samples for granular synthesis.
Declaration
public List<EngineRunningComponent.EngineSample> engineSamples
Field Value
| Type | Description |
|---|---|
| List<EngineRunningComponent.EngineSample> |
loadLowPassBoost
Additional lowpass frequency (Hz) added when engine is under load.
Declaration
public float loadLowPassBoost
Field Value
| Type | Description |
|---|---|
| float |
loadPitchBias
Pitch increase when engine is under load.
Declaration
public float loadPitchBias
Field Value
| Type | Description |
|---|---|
| float |
loadVolumeBias
Volume reduction when engine is unloaded (coasting).
Declaration
public float loadVolumeBias
Field Value
| Type | Description |
|---|---|
| float |
loadVolumeBoostDB
Volume swing in dB between coasting and full load, below the ceiling.
Declaration
public float loadVolumeBoostDB
Field Value
| Type | Description |
|---|---|
| float |
maxDistortion
Maximum distortion level (0-1) at full load.
Declaration
public float maxDistortion
Field Value
| Type | Description |
|---|---|
| float |
maxLowPass
Lowpass filter frequency at max RPM (Hz).
Declaration
public float maxLowPass
Field Value
| Type | Description |
|---|---|
| float |
maxPitch
Upper bound for sample playback pitch.
Declaration
public float maxPitch
Field Value
| Type | Description |
|---|---|
| float |
maxReverbDB
Legacy reverb dry-signal level in millibels when coasting.
Declaration
public float maxReverbDB
Field Value
| Type | Description |
|---|---|
| float |
maxVolumeDB
Engine mixer volume ceiling in dB. Volume swells up to this and never exceeds it.
Declaration
public float maxVolumeDB
Field Value
| Type | Description |
|---|---|
| float |
minLowPass
Lowpass filter frequency at idle RPM (Hz).
Declaration
public float minLowPass
Field Value
| Type | Description |
|---|---|
| float |
minPitch
Lower bound for sample playback pitch.
Declaration
public float minPitch
Field Value
| Type | Description |
|---|---|
| float |
minReverbDB
Legacy reverb dry-signal level in millibels when under load.
Declaration
public float minReverbDB
Field Value
| Type | Description |
|---|---|
| float |
mixerDistortionParam
Legacy AudioMixer exposed parameter name retained for serialized asset compatibility.
Declaration
public string mixerDistortionParam
Field Value
| Type | Description |
|---|---|
| string |
mixerLowPassParam
Legacy AudioMixer exposed parameter name retained for serialized asset compatibility.
Declaration
public string mixerLowPassParam
Field Value
| Type | Description |
|---|---|
| string |
mixerReverbParam
Legacy AudioMixer exposed parameter name retained for serialized asset compatibility.
Declaration
public string mixerReverbParam
Field Value
| Type | Description |
|---|---|
| string |
mixerVolumeParam
Legacy AudioMixer exposed parameter name retained for serialized asset compatibility.
Declaration
public string mixerVolumeParam
Field Value
| Type | Description |
|---|---|
| string |
rpmVolumeBoostDB
Volume swing in dB between idle and max RPM, below the ceiling.
Declaration
public float rpmVolumeBoostDB
Field Value
| Type | Description |
|---|---|
| float |
smoothing
SmoothDamp time for RPM and Load transitions.
Declaration
public float smoothing
Field Value
| Type | Description |
|---|---|
| float |
Properties
AudioMixerGroup
Gets the Audio Mixer Group this component's AudioSource should output to. Used to route audio through the vehicle's audio mixer for processing and mixing.
Declaration
public override AudioMixerGroup AudioMixerGroup { get; }
Property Value
| Type | Description |
|---|---|
| AudioMixerGroup |
Overrides
ContainerGO
Gets the GameObject container where the AudioSource should be created. Used to position audio sources at specific locations on the vehicle.
Declaration
public override GameObject ContainerGO { get; }
Property Value
| Type | Description |
|---|---|
| GameObject |
Overrides
InitLoop
Gets whether the AudioSource should loop continuously. Override in derived classes to enable looping for continuous sounds like engine running.
Declaration
public override bool InitLoop { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
InitializeWithNoClips
Gets whether this component can be initialized without any audio clips assigned. Most components require at least one clip to function.
Declaration
public override bool InitializeWithNoClips { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Priority
Gets the priority level for the AudioSource. Lower values indicate higher priority. Range is 0 (highest) to 256 (lowest). Used by Unity's audio system when the maximum number of audio sources is reached.
Declaration
public override int Priority { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
VC_Disable(bool)
Stops and disables the AudioSource belonging to this SoundComponent.
Declaration
public override bool VC_Disable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_Enable(bool)
Enables the AudioSource belonging to this SoundComponent.
Declaration
public override bool VC_Enable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_SetDefaults()
Writes default values into every serialized field, and may pull default assets from Resources. Runs on vehicle reset and when the component is first added.
Declaration
public override void VC_SetDefaults()
Overrides
VC_Update(float)
Per-frame update for input, visuals and UI. Only called while the component is active. Physics belongs in VC_FixedUpdate, not here.
Declaration
public override void VC_Update(float DeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | DeltaTime | Time elapsed since last Update in seconds |