Skip to content

SweejAmbience Technical Reference

This document provides technical details about SweejAmbience components, properties, and extension points.

Component Architecture

SweejAmbienceComponent

The foundation of the ambience system:

UPROPERTY(VisibleAnywhere, Transient, Category = "Sound")
float Weight{ 0.0f };

UPROPERTY(VisibleAnywhere, Transient, Category = "Sound")
float Level{ 0.0f };

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sound")
int32 Priority{0};

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sound")
float MaxWeight{1.0f};

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sound")
float ScatterSpotsThreshold{1.0f};

Key properties:

  • Weight: Current contribution to the mix (0-1 range), calculated dynamically
  • Level: Final volume multiplier based on weight and priority
  • Priority: Determines precedence when volumes overlap (higher values take precedence)
  • MaxWeight: Maximum possible contribution to the mix (0-1 range)
  • ScatterSpotsThreshold: Level at which scatter spots begin playing (0-1 range)

SweejAmbienceVolume

Defines the spatial bounds of ambient sounds:

UPROPERTY(VisibleAnywhere, Transient, Category = "Sound")
float Proximity{0};

UPROPERTY(EditAnywhere, Category = "Sound")
float AttenuationDistance{ 100.0f };

Key properties:

  • Proximity: Current distance from listener (0-1 range, 1 = fully inside)
  • AttenuationDistance: How far from the volume edge sounds begin to fade in

SweejAmbienceSound

A simple actor for placing non-volumetric ambient sounds:

  • Useful for environment-wide ambience or global sounds
  • Contains a SweejAmbienceComponent for consistent control
  • Can serve as a base for custom ambient behavior

AreaType System

UPROPERTY(EditAnywhere, Category = "AreaType Properties")
TArray<FSweejAreaTypePresetProperty> AreaTypePresetProperties;

UPROPERTY(EditAnywhere, Category = "AreaType Properties")
TMap<FSweejAmbienceAreaTypeEnumValue, FSweejSoundWaveList> AreaTypeSoundWaves;

AreaTypes require:

  • User-defined enumeration for area classifications in Project Settings
  • Each AreaType has a numeric ID for reference in the system
  • AreaTypePresetProperties define properties across different AreaTypes
  • AreaTypeSoundWaves associate sound waves with each AreaType

The SweejAmbienceAreaTypePreset asset allows storing properties and sounds by AreaType.

Ambience Definitions

The SweejAmbienceDefinition asset stores reusable configurations:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sound")
FSweejAmbienceAreaTypeEnumValue AreaType;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Sound")
TObjectPtr<USoundBase> SoundAsset{nullptr};

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sound")
TArray<TObjectPtr<USoundEffectSubmixPreset>> ReverbEffectChain;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sound")
TArray<TObjectPtr<USweejAmbienceScatterSpot>> ScatterSpotAssets;

Scatter Spot Configuration

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Scatter Spots")
TArray<FScatterSpot> ScatterSpots;

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Scatter Spots")
bool bEnablePreWarmedSpots{ false };

Each scatter spot configuration includes:

  • Repeat Time: Controls interval between sound triggers
  • Distance: Sets random distance from listener
  • Height: Configures vertical variation
  • Pre-warming: Enables quicker initial sound triggering

Extension Points

Blueprint Integration

Control weights and properties via Blueprint:

  • Access component properties directly
  • Create custom ambient behaviors
  • Respond to area changes and other system events

Tracer Component

The tracer component provides automatic area detection:

  • Uses line traces to detect environment characteristics
  • Converts trace results to ambience parameters
  • Adjusts ambient sounds based on environment without manual volumes

Watch Demo: Tracer Component

Reverb Effect Chain

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sound")
TArray<TObjectPtr<USoundEffectSubmixPreset>> ReverbEffectChain;

The reverb system works by:

  • Applying effects to a dedicated reverb submix
  • Calculating primary and secondary reverbs based on active volumes
  • Using a mix parameter to determine blend between primary and secondary effects
  • Automatically adjusting reverb based on listener position