Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

REFERENCECOMPONENTS

UCFEngineAudioComponent

MODULECrushformEngineINCLUDECFEngineAudioComponent.hPARENTUSceneComponent

Blueprint: Crushform Engine Audio

An engine's sound: the loops of a UCFEngineSoundProfile crossfaded and pitched by the engine speed, louder under load, with a starter while the engine cranks, a rise when it starts, a fade and a shutdown sound when it stops. The engine comes from the owner's ICFEngineHost (the explicit host, else UCFHostRegistry::FindHost), read once a frame. Each sound plays from its own UAudioComponent under this one, so this component goes where the engine is. Transitions follow the host's state every frame, not an event, so an engine that started or stopped out of earshot is heard as it is when the listener comes back. Presentation only: idle on a dedicated server.

Functions

AUTHORITY · server, every machineLOCAL · this machinePURE · read only
bool IsActiveForNetMode(ENetMode NetMode)
C++ ONLY

False only for a dedicated server, which has no listener to hear an engine.

void SetCrushformHost(UObject* NewHost)
C++ ONLY

Sets who answers ICFEngineHost for the owner; null means the registry's host for the owner. Call before BeginPlay: a later call, or an object that does not implement ICFEngineHost, is refused with a log line.

UObject* GetCrushformHost() const
PUREC++ ONLY

The explicit host, else UCFHostRegistry::FindHost(Owner, UCFEngineHost).

void SetCabinMuffling(bool bInMuffled, float InVolumeScale, float InLowPassFrequency)

Muffles the engine for a listener inside the cab (UCFVehicleAdapterComponent::SetCabinMuffled calls this when the listener enters or leaves). InVolumeScale is clamped to 0..1 and multiplies the volume while muffled; InLowPassFrequency is the cutoff in Hz. The volume follows on the next tick; the low-pass filter applies at once.

Category
Crushform|Engine Sound
bool IsCabinMuffled() const
PURE

Whether the engine is muffled for a listener inside the cab.

Category
Crushform|Engine Sound
float GetCabinVolumeScale() const
PUREC++ ONLY

The volume scale and low-pass frequency SetCabinMuffling last gave.

float GetCabinLowPassFrequency() const
PUREC++ ONLY

The low-pass cutoff in Hz that SetCabinMuffling last gave.

const UCFEngineSoundProfile* GetActiveProfile() const
PUREC++ ONLY

The profile in use: Profile, else UCFEngineSettings::DefaultProfile. Null before BeginPlay and while the sound is off.

int32 GetNumLayers() const
PUREC++ ONLY

The loops in play order: the profile's layers that have a sound, sorted by RPM.

float GetLayerRPM(int32 LayerIndex) const
PUREC++ ONLY

The recorded engine speed of a loop in play order, RPM; 0 for an index out of range.

UAudioComponent* GetLayerAudio(int32 LayerIndex) const
PUREC++ ONLY

The audio component playing one loop; nullptr until that loop is first heard or for an index out of range.

UAudioComponent* GetStarterAudio() const
PUREC++ ONLY

The starter's and the shutdown's audio components; nullptr until first played.

bool IsStarterPlaying() const
PUREC++ ONLY

Whether the starter sound is meant to play: the engine cranks and the profile has one.

int32 GetShutdownPlayCount() const
PUREC++ ONLY

How many times the shutdown sound was started.

float GetHeardRPM() const
PUREC++ ONLY

The heard engine speed, RPM.

float GetHeardLoad() const
PUREC++ ONLY

The heard load, 0..1.

float GetRunLevel() const
PUREC++ ONLY

How far the loops have risen: 0 silent, 1 running.

void SetAudibilityOverrideForTest(TOptional<bool> InOverride)
C++ ONLY

Tests only. An unset override restores the real check; a set one answers the listener-in-range question.

Properties

TObjectPtr<UCFEngineSoundProfile> Profile

The engine's sound; empty: Project Settings > Plugins > Crushform Engine > Default Profile. Read in BeginPlay.

Category
Crushform|Engine Sound