Class EngineRunningComponent
Granular engine audio synthesis using AudioMixer. Crossfades multiple RPM samples and controls mixer effects (lowpass, distortion, reverb).
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
Reverb level in dB when coasting (wet).
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
Reverb level in dB when under load (dry).
Declaration
public float minReverbDB
Field Value
| Type | Description |
|---|---|
| float |
mixerDistortionParam
AudioMixer exposed parameter name for distortion level.
Declaration
public string mixerDistortionParam
Field Value
| Type | Description |
|---|---|
| string |
mixerLowPassParam
AudioMixer exposed parameter name for lowpass filter frequency.
Declaration
public string mixerLowPassParam
Field Value
| Type | Description |
|---|---|
| string |
mixerReverbParam
AudioMixer exposed parameter name for reverb mix.
Declaration
public string mixerReverbParam
Field Value
| Type | Description |
|---|---|
| string |
mixerVolumeParam
AudioMixer exposed parameter name for volume control.
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()
Resets the component to default configuration. Override to provide component-specific default values.
Declaration
public override void VC_SetDefaults()
Overrides
Remarks
Called when the vehicle is reset or when first added to a GameObject. Should set all serialized fields to sensible default values. May load default assets from Resources folder.
VC_Update(float)
Frame-rate dependent update called every frame. Override for visual updates and input handling.
Declaration
public override void VC_Update(float DeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | DeltaTime | Time elapsed since last Update in seconds |
Overrides
Remarks
Only called when the component is active (initialized and enabled). Use for visual effects, UI updates, and other frame-dependent operations. Avoid physics calculations here - use VC_FixedUpdate instead.