Module: LCKUnrealAudio | Version: 1.0 | Platforms: All
Overview
LCKUnrealAudio captures audio through Unreal Engine’s built-in audio system. It is the default audio source and supports both game audio and microphone input without any third-party dependencies.
Supported Channels
| Channel | Supported | Description |
|---|
Game | Yes | Unreal Engine audio submix output |
Microphone | Yes | Platform microphone via Unreal Audio |
VoiceChat | No | Use LCKVivox |
FLCKUnrealFeatureInstance
Primary audio source class. Implements ILCKFeatureInstance with dual-channel support for game audio and microphone capture.
class FLCKUnrealFeatureInstance : public ILCKFeatureInstance
{
public:
// ILCKFeatureInstance interface
virtual bool StartCapture() noexcept override;
virtual bool StartCapture(TLCKAudioChannelsMask Channels) noexcept override;
virtual void StopCapture() noexcept override;
virtual float GetVolume() const noexcept override;
virtual const FString& GetSourceName() const noexcept override;
protected:
TLCKAudioChannelsMask SupportedChannels =
ELCKAudioChannel::Game | ELCKAudioChannel::Microphone;
};
ILCKFeatureInstance Methods
| Method | Behavior |
|---|
StartCapture() | Begins capture on both game and microphone channels |
StartCapture(Channels) | Begins capture for the specified channel mask only |
StopCapture() | Stops all active capture |
GetVolume() | Returns current RMS volume across active channels (0.0-1.0) |
GetSourceName() | Returns "LCKUnrealAudio" |
Usage
// Get the Unreal audio source
TSharedPtr<FLCKUnrealFeatureInstance> Source = /* from module or modular features */;
// Bind audio data delegate
Source->OnAudioDataDelegate.BindLambda([](
TArrayView<const float> PCM,
int32 Channels,
int32 SampleRate,
ELCKAudioChannel SourceChannel)
{
// SourceChannel will be Game or Microphone
// depending on which channel produced the data
});
// Start capturing both channels
Source->StartCapture();
ULCKUnrealAudioBPL
Blueprint function library exposing Unreal audio utilities.
UCLASS()
class ULCKUnrealAudioBPL : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "LCK")
static int32 GetUnrealAudioSamplerate() noexcept;
};
| Method | Returns | Description |
|---|
GetUnrealAudioSamplerate() | int32 | Current Unreal Engine audio sample rate in Hz |
Blueprint Usage
Call Get Unreal Audio Samplerate from any Blueprint to query the engine’s current audio sample rate. This is useful for verifying that game audio and voice chat sample rates match.
FLCKUnrealAudioModule
Module that manages the lifecycle of FLCKUnrealFeatureInstance.
class FLCKUnrealAudioModule : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
private:
TSharedPtr<FLCKUnrealFeatureInstance> FeatureInstance;
};
IMPLEMENT_MODULE(FLCKUnrealAudioModule, LCKUnrealAudio)
On startup, the module creates an FLCKUnrealFeatureInstance instance and registers it as a modular feature. On shutdown, it unregisters and destroys the source.
Log Category
DECLARE_LOG_CATEGORY_EXTERN(LogLCKUnrealAudio, Log, All);