# 5. API Reference | UFMODAudioComponent

This documentation is preliminary and is subject to change.

This class inherits from USceneComponent

Defines:

- EFMODEventProperty
- FTimelineMarkerProperties
- FTimelineBeatProperties
- FFMODAttenuationDetails
- FFMODOcclusionDetails

Properties:

Public:

- UFMODAudioComponent::Event The event asset to use for this sound.
- UFMODAudioComponent::ParameterCache Cache of the current Events parameters.
- UFMODAudioComponent::bDefaultParameterValuesCached Have the Event parameters default values been cached.
- UFMODAudioComponent::ProgrammerSoundName Sound name used for programmer sound.
- UFMODAudioComponent::bEnableTimelineCallbacks Enable timeline callbacks for this sound, so that OnTimelineMarker and OnTimelineBeat can be used.
- UFMODAudioComponent::StoredProperties Stored properties to apply next time we create an instance.
- UFMODAudioComponent::bAutoDestroy Auto destroy this component on completion.
- UFMODAudioComponent::bStopWhenOwnerDestroyed Stop sound when owner is destroyed.
- UFMODAudioComponent::bApplyAmbientVolumes Whether we apply gain and low-pass based on audio zones.
- UFMODAudioComponent::bApplyOcclusionParameter Whether we apply gain and low-pass based on occlusion onto a parameter.
- UFMODAudioComponent::OnEventStopped Called when an event stops, either because it played to completion or because a Stop() call turned it off early.
- UFMODAudioComponent::OnTimelineMarker Called when we reach a named marker (if bEnableTimelineCallbacks is true).
- UFMODAudioComponent::OnTimelineBeat Called when we reach a beat of a tempo (if bEnableTimelineCallbacks is true).
- UFMODAudioComponent::AttenuationDetails FMOD Custom Attenuation Details.
- UFMODAudioComponent::OcclusionDetails FMOD Custom Occlusion Details.
- UFMODAudioComponent::StudioInstance Actual Studio instance handle.

Private:

- UFMODAudioComponent::Module Stored reference to the current IFMODStudioModule.
- UFMODAudioComponent::InteriorLastUpdateTime Timer used for volumes fading in and out.
- UFMODAudioComponent::SourceInteriorVolume Previous interior volume value.
- UFMODAudioComponent::SourceInteriorLPF Previous interior LPF value.
- UFMODAudioComponent::CurrentInteriorVolume Current interior volume value.
- UFMODAudioComponent::CurrentInteriorLPF Previous interior LPF value.
- UFMODAudioComponent::AmbientVolume Calculated Ambient volume level for that frame.
- UFMODAudioComponent::AmbientLPF Calculated Ambient LPF level for that frame.
- UFMODAudioComponent::LastLPF Previously set LPF value.
- UFMODAudioComponent::LastVolume Previously set Volume value.
- UFMODAudioComponent::wasOccluded Was the object occluded in the previous frame.
- UFMODAudioComponent::OcclusionID Stored ID of the Occlusion parameter of the Event (if applicable).
- UFMODAudioComponent::AmbientVolumeID Stored ID of the Volume parameter of the Event (if applicable).
- UFMODAudioComponent::AmbientLPFID Stored ID of the LPF parameter of the Event (if applicable).
- UFMODAudioComponent::CallbackLock A scope lock used specifically for callbacks.
- UFMODAudioComponent::CallbackMarkerQueue Stores the Timeline Markers as they are triggered.
- UFMODAudioComponent::CallbackBeatQueue Stores the Timeline Beats as they are triggered.
- UFMODAudioComponent::ProgrammerSound Direct assignment of programmer sound from other C++ code.
- UFMODAudioComponent::EventLength The length of the current Event in milliseconds.

Methods:

Public:

- UFMODAudioComponent::SetEvent New Event to be used by the FMODAudioComponent.
- UFMODAudioComponent::Play Start a sound playing on an audio component.
- UFMODAudioComponent::Stop Stop an audio component playing.
- UFMODAudioComponent::Release Release the current Studio Instance.
- UFMODAudioComponent::TriggerCue Trigger a cue in an event.
- UFMODAudioComponent::IsPlaying Return true if this component is currently playing an event.
- UFMODAudioComponent::SetVolume Set volume on an audio component.
- UFMODAudioComponent::SetPitch Set pitch on an audio component.
- UFMODAudioComponent::SetPaused Pause/Unpause an audio component.
- UFMODAudioComponent::SetParameter Set a parameter of the Event.
- UFMODAudioComponent::GetParameter Get parameter value from the Event.
- UFMODAudioComponent::SetProperty Set a property of the Event.
- UFMODAudioComponent::GetProperty Get a property of the Event.
- UFMODAudioComponent::GetLength Get the event length in milliseconds.
- UFMODAudioComponent::SetTimelinePosition Set the timeline position in milliseconds
- UFMODAudioComponent::GetTimelinePosition Get the timeline position in milliseconds.
- UFMODAudioComponent::OnPlaybackCompleted Called when the event has finished stopping.
- UFMODAudioComponent::UpdateInteriorVolumes Update gain and low-pass based on interior volumes.
- UFMODAudioComponent::SetProgrammerSoundName Set the sound name to use for programmer sound.
- UFMODAudioComponent::SetProgrammerSound Set a programmer sound to use for this audio component. Lifetime of sound must exceed that of the audio component.
- UFMODAudioComponent::UpdateAttenuation Update attenuation if we have it set.
- UFMODAudioComponent::ApplyVolumeLPF Apply Volume and LPF to Event.
- UFMODAudioComponent::CacheDefaultParameterValues Cache default event parameter values
- UFMODAudioComponent::PlayInternal Internal play function which can play Events in the editor.
- UFMODAudioComponent::EventCallbackAddMarker Timeline Marker callback.
- UFMODAudioComponent::EventCallbackAddBeat Timeline Beat callback.
- UFMODAudioComponent::EventCallbackCreateProgrammerSound Programmer Sound Create callback.
- UFMODAudioComponent::EventCallbackDestroyProgrammerSound Programmer Sound Destroy callback.
- UFMODAudioComponent::Activate Activates the component.
- UFMODAudioComponent::Deactivate Deactivates the SceneComponent.
- UFMODAudioComponent::OnUpdateTransform Native callback when this component is moved.

Private:

- UFMODAudioComponent::OnRegister Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called.
- UFMODAudioComponent::OnUnregister Called when a component is unregistered. Called after DestroyRenderState_Concurrent and OnDestroyPhysicsState are called.
- UFMODAudioComponent::EndPlay Overridable function called whenever this actor is being removed from a level.
- UFMODAudioComponent::TickComponent Function called every frame on this ActorComponent.
- UFMODAudioComponent::ReleaseEventCache Release any cached parameters then the Studio Instance.
- UFMODAudioComponent::ReleaseEventInstance Release the Studio Instance.
- UFMODAudioComponent::GetStudioModule Return a cached reference to the current IFMODStudioModule.

## UFMODAudioComponent::Activate

Activates the component.

C++

    virtual void Activate(
      bool bReset = false
    );

bReset
  Whether the activation should happen even if ShouldActivate returns false.

## UFMODAudioComponent::AmbientLPF

Calculated Ambient LPF level for that frame.

C++

    float AmbientLPF;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::AmbientLPFID

Stored ID of the LPF parameter of the Event (if applicable).

C++

    FMOD_STUDIO_PARAMETER_ID AmbientLPFID;

See Also: Ambient Zones, FMOD_STUDIO_PARAMETER_ID

## UFMODAudioComponent::AmbientVolume

Calculated Ambient volume level for that frame.

C++

    float AmbientVolume;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::AmbientVolumeID

Stored ID of the Volume parameter of the Event (if applicable).

C++

    FMOD_STUDIO_PARAMETER_ID AmbientVolumeID;

See Also: Ambient Zones, FMOD_STUDIO_PARAMETER_ID

## UFMODAudioComponent::ApplyVolumeLPF

Apply Volume and LPF to Event.

C++

    void ApplyVolumeLPF();

## UFMODAudioComponent::AttenuationDetails

FMOD Custom Attenuation Details.

C++

    struct FFMODAttenuationDetails AttenuationDetails;

See Also: FFMODAttenuationDetails

## UFMODAudioComponent::bApplyAmbientVolumes

Whether we apply gain and low-pass based on audio zones.

C++

    uint32 bApplyAmbientVolumes : 1;

## UFMODAudioComponent::bApplyOcclusionParameter

Whether we apply gain and low-pass based on occlusion onto a parameter.

C++

    uint32 bApplyOcclusionParameter : 1;

## UFMODAudioComponent::bAutoDestroy

Auto destroy this component on completion.

C++

    uint32 bAutoDestroy : 1;

## UFMODAudioComponent::bDefaultParameterValuesCached

Have the Event parameters default values been cached.

C++

    bool bDefaultParameterValuesCached;

## UFMODAudioComponent::bEnableTimelineCallbacks

Enable timeline callbacks for this sound, so that OnTimelineMarker and OnTimelineBeat can be used.

C++

    uint32 bEnableTimelineCallbacks : 1;

See Also: UFMODAudioComponent::OnTimelineMarker, UFMODAudioComponent::OnTimelineBeat

## UFMODAudioComponent::bStopWhenOwnerDestroyed

Stop sound when owner is destroyed.

C++

    uint32 bStopWhenOwnerDestroyed : 1;

## UFMODAudioComponent::CacheDefaultParameterValues

Cache default event parameter values

C++

    void CacheDefaultParameterValues()

## UFMODAudioComponent::CallbackBeatQueue

Stores the Timeline Beats as they are triggered.

C++

    TArray<FTimelineBeatProperties> CallbackBeatQueue;

See Also: UFMODAudioComponent::EventCallbackAddBeat

## UFMODAudioComponent::CallbackLock

A scope lock used specifically for callbacks.

C++

    FCriticalSection CallbackLock;

## UFMODAudioComponent::CallbackMarkerQueue

Stores the Timeline Markers as they are triggered.

C++

    TArray<FTimelineMarkerProperties> CallbackMarkerQueue;

See Also: UFMODAudioComponent::EventCallbackAddMarker

## UFMODAudioComponent::CurrentInteriorLPF

Previous interior LPF value.

C++

    float CurrentInteriorLPF;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::CurrentInteriorVolume

Current interior volume value.

C++

    float CurrentInteriorVolume;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::Deactivate

Deactivates the SceneComponent.

C++

    virtual void Deactivate();

## UFMODAudioComponent::EndPlay

Overridable function called whenever this actor is being removed from a level.

C++

    virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override

EndPlayReason
  Why an actor is being deleted/removed from a level.

## UFMODAudioComponent::Event

The event asset to use for this sound.

C++

    TAssetPtr<class UFMODEvent> Event;

See Also: UFMODEvent

## UFMODAudioComponent_EventCallback

Generic callback used for the Studio Instance.

C++

    FMOD_RESULT F_CALLBACK UFMODAudioComponent_EventCallback(
      FMOD_STUDIO_EVENT_CALLBACK_TYPE type,
      FMOD_STUDIO_EVENTINSTANCE *event, void *parameters
    );

type
  The type of callback being triggered.
event
  Reference to the Studio Instance.
parameters
  Info about the callback.

This is on set on the UFMODAudioComponent::StudioInstance if UFMODAudioComponent::bEnableTimelineCallbacks is true or UFMODAudioComponent::ProgrammerSoundName is not empty.

See Also: FMOD_STUDIO_EVENT_CALLBACK_TYPE, UFMODAudioComponent::EventCallbackAddMarker, UFMODAudioComponent::EventCallbackAddBeat, UFMODAudioComponent::EventCallbackCreateProgrammerSound, UFMODAudioComponent::EventCallbackDestroyProgrammerSound

## UFMODAudioComponent::EventCallbackAddBeat

Timeline Beat callback.

C++

    void EventCallbackAddBeat(
      struct FMOD_STUDIO_TIMELINE_BEAT_PROPERTIES *props
    );

props
  Callback properties.

See Also: UFMODAudioComponent_EventCallback, FMOD_STUDIO_TIMELINE_BEAT_PROPERTIES

## UFMODAudioComponent::EventCallbackAddMarker

Timeline Marker callback.

C++

    void EventCallbackAddMarker(
      struct FMOD_STUDIO_TIMELINE_MARKER_PROPERTIES *props
    );

props
  Callback properties.

See Also: UFMODAudioComponent_EventCallback, FMOD_STUDIO_TIMELINE_MARKER_PROPERTIES

## UFMODAudioComponent::EventCallbackCreateProgrammerSound

Programmer Sound Create callback.

C++

    void EventCallbackCreateProgrammerSound(
      struct FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES *props
    );

props
  Callback properties.

See Also: UFMODAudioComponent_EventCallback, FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES

## UFMODAudioComponent::EventCallbackDestroyProgrammerSound

Programmer Sound Destroy callback.

C++

    void EventCallbackDestroyProgrammerSound(
      struct FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES *props
    );

props
  Callback properties.

See Also: UFMODAudioComponent_EventCallback, FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES

## UFMODAudioComponent::EventLength

The length of the current Event in milliseconds.

C++

    int32 EventLength;

## UFMODAudioComponent::GetLength

Get the event length in milliseconds.

C++

    int32 GetLength() const;

## UFMODAudioComponent::GetParameter

Get parameter value from the Event.

C++

    float GetParameter(
      FName Name
    );

Name
  Name of the parameter.

## UFMODAudioComponent::GetProperty

Get a property of the Event.

C++

    float GetProperty(
      EFMODEventProperty::Type Property
    );

Property
  Enum to describe built-in event properties.

See Also: EFMODEventProperty

## UFMODAudioComponent::GetStudioModule

Return a cached reference to the current IFMODStudioModule.

C++

    IFMODStudioModule& GetStudioModule();

See Also: IFMODStudioModule

## UFMODAudioComponent::GetTimelinePosition

Get the timeline position in milliseconds.

C++

    int32 GetTimelinePosition();

## UFMODAudioComponent::InteriorLastUpdateTime

Timer used for volumes fading in and out.

C++

    double InteriorLastUpdateTime;

## UFMODAudioComponent::IsPlaying

Return true if this component is currently playing an event.

C++

    bool IsPlaying();

## UFMODAudioComponent::LastLPF

Previously set LPF value.

C++

    float LastLPF;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::LastVolume

Previously set Volume value.

C++

    float LastVolume;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::Module

Stored reference to the current IFMODStudioModule.

C++

    IFMODStudioModule* Module;

See Also: IFMODStudioModule

## UFMODAudioComponent::OcclusionDetails

FMOD Custom Occlusion Details.

C++

    struct FFMODOcclusionDetails OcclusionDetails;

See Also: FFMODOcclusionDetails

## UFMODAudioComponent::OcclusionID

Stored ID of the Occlusion parameter of the Event (if applicable).

C++

    FMOD_STUDIO_PARAMETER_ID OcclusionID;

See Also: Occlusion, FMOD_STUDIO_PARAMETER_ID

## UFMODAudioComponent::OnEventStopped

Called when an event stops, either because it played to completion or because a Stop() call turned it off early.

C++

    FOnEventStopped OnEventStopped;

## UFMODAudioComponent::OnPlaybackCompleted

Called when the event has finished stopping.

C++

    void OnPlaybackCompleted();

## UFMODAudioComponent::OnRegister

Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called.

C++

    virtual void OnRegister();

## UFMODAudioComponent::OnTimelineBeat

Called when we reach a beat of a tempo (if bEnableTimelineCallbacks is true).

C++

    FOnTimelineMarker OnTimelineBeat;

See Also: UFMODAudioComponent::bEnableTimelineCallbacks

## UFMODAudioComponent::OnTimelineMarker

Called when we reach a named marker (if bEnableTimelineCallbacks is true).

C++

    FOnTimelineMarker OnTimelineMarker;

See Also: UFMODAudioComponent::bEnableTimelineCallbacks

## UFMODAudioComponent::OnUnregister

Called when a component is unregistered. Called after DestroyRenderState_Concurrent and OnDestroyPhysicsState are called.

C++

    virtual void OnUnregister();

## UFMODAudioComponent::OnUpdateTransform

Native callback when this component is moved.

C++

    virtual void OnUpdateTransform(
      EUpdateTransformFlags UpdateTransformFlags,
      ETeleportType Teleport = ETeleportType::None
    );

Used to update the 3D positional information of the Event.

## UFMODAudioComponent::ParameterCache

Cache of the current Events parameters.

C++

    TMap<FName, float> ParameterCache;

## UFMODAudioComponent::Play

Start a sound playing on an audio component.

C++

    void Play();

## UFMODAudioComponent::PlayInternal

Internal play function which can play Events in the editor.

C++

    void PlayInternal(
      EFMODSystemContext::Type Context
    );

Context
  Which FMOD Studio system to use.

See Also: EFMODSystemContext

## UFMODAudioComponent::ProgrammerSound

Direct assignment of programmer sound from other C++ code.

C++

    FMOD::Sound *ProgrammerSound;

See Also: FMOD::Sound

## UFMODAudioComponent::ProgrammerSoundName

Sound name used for programmer sound.

C++

    FString ProgrammerSoundName;

The integration will look up the name in any loaded audio table.

## UFMODAudioComponent::Release

Release the current Studio Instance.

C++

    void Release();

See Also: UFMODAudioComponent::StudioInstance

## UFMODAudioComponent::ReleaseEventCache

Release any cached parameters then the Studio Instance.

C++

    void ReleaseEventCache();

See Also: UFMODAudioComponent::StudioInstance

## UFMODAudioComponent::ReleaseEventInstance

Release the Studio Instance.

C++

    void ReleaseEventInstance();

See Also: UFMODAudioComponent::StudioInstance

## UFMODAudioComponent::SetEvent

New Event to be used by the FMODAudioComponent.

C++

    void SetEvent(
      UFMODEvent *NewEvent
    );

NewEvent
  New Event Asset reference to use.

If an Event is currently playing, it will be stopped and the new Event passed in will be started.

See Also: UFMODEvent

## UFMODAudioComponent::SetParameter

Set a parameter of the Event.

C++

    void SetParameter(
      FName Name,
      float Value
    );

Name
  Name of the parameter.
Value
  Value to apply to the parameter.

## UFMODAudioComponent::SetPaused

Pause/Unpause an audio component.

C++

    void SetPaused(
      bool paused
    );

paused
  The paused state to apply.

## UFMODAudioComponent::SetPitch

Set pitch on an audio component.

C++

    void SetPitch(
      float pitch
    );

pitch
  New pitch multiplier to apply.

The pitch multiplier is used to modulate the event instance's pitch. It can be set to any value greater than or equal to zero but the final combined pitch is clamped to the range [0, 100] before being applied.

## UFMODAudioComponent::SetProgrammerSound

Set a programmer sound to use for this audio component. Lifetime of sound must exceed that of the audio component.

C++

    void SetProgrammerSound(
      FMOD::Sound *Sound
    );

Sound
  User created sound to use.

See Als: FMOD::Sound

## UFMODAudioComponent::SetProgrammerSoundName

Set the sound name to use for programmer sound.

C++

    void SetProgrammerSoundName(
      FString Value
    );

Value
  Name of sound or file to use.

The integration will look up the name in any loaded audio table.

## UFMODAudioComponent::SetProperty

Set a property of the Event.

C++

    void SetProperty(
      EFMODEventProperty::Type Property,
      float Value
    );

Property
  Enum to describe built-in event properties.
Value
  Value to apply to the property.

See Also: EFMODEventProperty

## UFMODAudioComponent::SetTimelinePosition

Set the timeline position in milliseconds

C++

    void SetTimelinePosition(
      int32 Time
    );

Time
  Time in milliseconds.

## UFMODAudioComponent::SetVolume

Set volume on an audio component.

C++

    void SetVolume(
      float volume
    );

volume
  New volume level to apply.

This volume is applied as a scaling factor for the event volume. It does not override the volume level set in FMOD Studio, nor any internal volume automation or modulation.

## UFMODAudioComponent::SourceInteriorLPF

Previous interior LPF value.

C++

    float SourceInteriorLPF;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::SourceInteriorVolume

Previous interior volume value.

C++

    float SourceInteriorVolume;

Used for automating volume and/or LPF with Ambient Zones.

See Also: Ambient Zones

## UFMODAudioComponent::Stop

Stop an audio component playing.

C++

    void Stop();

## UFMODAudioComponent::StoredProperties

Stored properties to apply next time we create an instance.

C++

    float StoredProperties[EFMODEventProperty::Count];

See Also: EFMODEventProperty

## UFMODAudioComponent::StudioInstance

Actual Studio instance handle.

C++

    FMOD::Studio::EventInstance *StudioInstance;

## UFMODAudioComponent::TickComponent

Function called every frame on this ActorComponent.

C++

    virtual void TickComponent(
      float DeltaTime,
      enum ELevelTick TickType,
      FActorComponentTickFunction *ThisTickFunction
    );

Only executes if the component is registered, and also PrimaryComponentTick.bCanEverTick must be set to true.

## UFMODAudioComponent::TriggerCue

Trigger a cue in an event.

C++

    void TriggerCue();

## UFMODAudioComponent::UpdateAttenuation

Update attenuation if we have it set.

C++

    void UpdateAttenuation();

## UFMODAudioComponent::UpdateInteriorVolumes

Update gain and low-pass based on interior volumes.

C++

    void UpdateInteriorVolumes();

## UFMODAudioComponent::wasOccluded

Was the object occluded in the previous frame.

C++

    bool wasOccluded;

See Also: Occlusion