> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liv.tv/llms.txt
> Use this file to discover all available pages before exploring further.

# Module Loading 

> LCK SDK module hierarchy, loading phases, and dependencies for Unreal Engine projects.

## What Problem Does This Solve?

When integrating LCK into your Unreal project, you need to know:

* Which modules to enable (core vs. optional)
* Loading order (some modules must load before others)
* Platform-specific modules (Windows vs. Android)
* Audio plugin priorities (FMOD vs. Wwise vs. Unreal Audio)

This page explains module dependencies so you can configure your project correctly.

## When to Read This

Read this when:

* First-time LCK integration
* Adding audio middleware (FMOD, Wwise, Vivox)
* Troubleshooting module loading errors
* Building for multiple platforms
* Creating custom audio sources

Skip this if you're just using the default tablet with UnrealAudio.

***

## Module Hierarchy

```
LCKVulkan (EarliestPossible) ← Android Vulkan interop
    ↓
LCKCore (PostDefault) ← Recording subsystem
    ├── LCKAudio (PostDefault) ← Audio framework
    ├── LCKWindowsEncoder (PostDefault, Win64 only)
    ├── LCKAndroidEncoder (PostDefault, Android only)
    └── LCKAndroidGallery (PostDefault, Android only)
    ↓
LCKTablet (Default) ← High-level service
    └── LCKUI (Default) ← UI components
    ↓
Optional Audio Plugins (Default):
    ├── LCKFMOD
    ├── LCKWwise (Win64, Android)
    ├── LCKVivox
    └── LCKOboe (Android only)
```

***

## Loading Phases Explained

| Phase              | When It Loads                | What It's For                               |
| ------------------ | ---------------------------- | ------------------------------------------- |
| `EarliestPossible` | Before engine init           | Critical low-level systems (Vulkan interop) |
| `PostDefault`      | After engine, before game    | Core functionality (encoders, audio)        |
| `Default`          | Standard game module loading | UI, high-level systems, optional plugins    |

<Warning>
  **`Never change LCKVulkan loading phase.`** It must load at `EarliestPossible` for Android Vulkan interop to work. Changing it will break Quest recording.
</Warning>

***

## Core Modules (Required)

### LCKCore

**Phase:** PostDefault\
**Platforms:** All\
**What it does:**

* `ULCKRecorderSubsystem` — Low-level recording control
* `ULCKTelemetrySubsystem` — Analytics
* `ULCKDeveloperSettings` — Project configuration
* Encoder factory interface

**Dependencies:** None (base module)

**When to use:** Always required. This is the foundation.

***

### LCKAudio

**Phase:** PostDefault\
**Platforms:** All\
**What it does:**

* `ILCKAudioSource` interface
* `FLCKAudioMix` for combining sources
* Audio channel management

**Dependencies:** LCKCore

**When to use:** Always required if you want audio in recordings.

***

### LCKTablet

**Phase:** Default\
**Platforms:** All\
**What it does:**

* `ULCKSubsystem` — World subsystem
* `ULCKService` — High-level recording API
* `ALCKTablet` — Tablet actor
* `ULCKTabletDataModel` — State management

**Dependencies:** LCKCore, LCKUI

**When to use:** Use this unless you're building completely custom UI. Most developers want this.

***

### LCKUI

**Phase:** Default\
**Platforms:** All\
**What it does:**

* `ULCKButton` — Interactive 3D buttons
* `ULCKSlider` — Slider controls
* Recording state visualization

**Dependencies:** LCKCore

**When to use:** Use if you want 3D UI components (buttons, sliders) in your world.

***

## Platform-Specific Modules

<Warning>
  Platform-specific modules are automatically loaded by LCK. **You don't need to manually enable them** in your `.Build.cs` file.
</Warning>

### Windows Only

#### LCKWindowsEncoder

**Phase:** PostDefault\
**Platforms:** Win64\
**What it does:** Windows Media Foundation encoder (H.264, AAC, MP4)

**Technologies:**

* `IMFSinkWriter` for muxing
* `IMFTransform` for H.264 encoding
* Direct3D 11 texture interop

**Auto-loaded:** Yes (on Windows builds)

***

### Android Only

#### LCKAndroidEncoder

**Phase:** PostDefault\
**Platforms:** Android\
**What it does:** NDK MediaCodec encoder (H.264, AAC, MP4)

**Technologies:**

* `AMediaCodec` for encoding
* `AMediaMuxer` for MP4 container
* Vulkan/EGL texture interop

**Auto-loaded:** Yes (on Android builds)

***

#### LCKAndroidGallery

**Phase:** PostDefault\
**Platforms:** Android\
**What it does:** Save recordings to Android gallery

**Features:**

* MediaStore integration
* Gallery notifications
* Scoped storage support

**Auto-loaded:** Yes (on Android builds)

***

#### LCKVulkan

**Phase:** EarliestPossible\
**Platforms:** Android\
**What it does:** Vulkan interop for Quest devices

**Critical:** Must load before engine initialization

**Auto-loaded:** Yes (on Android builds)

***

## Optional Audio Plugins

Audio plugins are **optional** and must be manually enabled if you want to use them.

### Audio Priority Order

When multiple audio plugins are available, LCK uses this priority for **game audio**:

1. **LCKFMOD** (highest priority)
2. **LCKWwise**
3. **LCKUnrealAudio** (built-in, always available)

<Info>
  Only ONE game audio source is active at a time. Microphone and voice chat can run alongside game audio.
</Info>

### LCKFMOD

**Phase:** Default\
**Platforms:** Win64, Android\
**Requires:** FMODStudio plugin\
**What it does:** Capture FMOD game audio

**Features:**

* DSP-based capture from master bus
* Zero-copy audio pipeline
* Automatic FMOD detection

**How to enable:**

```csharp theme={null}
// YourGame.Build.cs
PublicDependencyModuleNames.Add("LCKFMOD");
```

***

### LCKWwise

**Phase:** Default\
**Platforms:** Win64, Android\
**Requires:** Wwise plugin\
**What it does:** Capture Wwise game audio

**Features:**

* Output capture callback
* 3rd-order ambisonic support
* Stereo downmix

**How to enable:**

```csharp theme={null}
// YourGame.Build.cs
PublicDependencyModuleNames.Add("LCKWwise");
```

***

### LCKVivox

**Phase:** Default\
**Platforms:** All\
**Requires:** VivoxCore plugin\
**What it does:** Capture Vivox voice chat

**Features:**

* Microphone capture (outgoing voice)
* Incoming voice capture (other players)
* Thread-safe callbacks

**How to enable:**

```csharp theme={null}
// YourGame.Build.cs
PublicDependencyModuleNames.Add("LCKVivox");
```

***

### LCKOboe (Android Low-Latency Mic)

**Phase:** Default\
**Platforms:** Android only\
**What it does:** Google Oboe microphone capture

**Features:**

* Low-latency audio input
* AAudio/OpenSL ES abstraction
* Optimized for Quest

**How to enable:**

```csharp theme={null}
// YourGame.Build.cs
if (Target.Platform == UnrealTargetPlatform.Android)
{
    PublicDependencyModuleNames.Add("LCKOboe");
}
```

***

## Build.cs Configuration

### Minimal Setup (Core Only)

```csharp theme={null}
// YourGame.Build.cs
public class YourGame : ModuleRules
{
    public YourGame(ReadOnlyTargetRules Target) : base(Target)
    {
        // Minimum required
        PublicDependencyModuleNames.AddRange(new string[] {
            "LCKCore"  // Recording subsystem
        });
    }
}
```

This gives you low-level recording via `ULCKRecorderSubsystem`. No UI, no service.

***

### Standard Setup (With Tablet UI)

```csharp theme={null}
public class YourGame : ModuleRules
{
    public YourGame(ReadOnlyTargetRules Target) : base(Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] {
            "LCKCore",    // Required
            "LCKTablet",  // High-level service
            "LCKUI"       // UI components
        });
    }
}
```

This gives you `ULCKService` and the default tablet actor. **Recommended for most developers.**

***

### Full Setup (With Audio Middleware)

```csharp theme={null}
public class YourGame : ModuleRules
{
    public YourGame(ReadOnlyTargetRules Target) : base(Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] {
            "LCKCore",
            "LCKTablet",
            "LCKUI"
        });
        
        // Optional: FMOD integration
        if (Target.Platform == UnrealTargetPlatform.Win64 ||
            Target.Platform == UnrealTargetPlatform.Android)
        {
            PublicDependencyModuleNames.Add("LCKFMOD");
        }
        
        // Optional: Vivox voice chat
        PublicDependencyModuleNames.Add("LCKVivox");
        
        // Optional: Android low-latency mic
        if (Target.Platform == UnrealTargetPlatform.Android)
        {
            PublicDependencyModuleNames.Add("LCKOboe");
        }
    }
}
```

***

## Plugin Configuration (.uproject)

### Basic Plugin Entry

```json theme={null}
{
  "Plugins": [
    {
      "Name": "LCK",
      "Enabled": true
    }
  ]
}
```

### Optional Audio Plugins

```json theme={null}
{
  "Plugins": [
    {
      "Name": "LCK",
      "Enabled": true
    },
    {
      "Name": "LCKFMOD",
      "Enabled": true,
      "Optional": true,
      "SupportedTargetPlatforms": ["Win64", "Android"]
    },
    {
      "Name": "LCKWwise",
      "Enabled": true,
      "Optional": true,
      "SupportedTargetPlatforms": ["Win64", "Android"]
    }
  ]
}
```

**`Why Optional: true?`** If the plugin isn't present (e.g., FMOD plugin not installed), the game will still launch without errors.

***

## Checking Module Availability at Runtime

```cpp theme={null}
// Check if FMOD module is loaded
bool bFMODLoaded = FModuleManager::Get().IsModuleLoaded("LCKFMOD");

// Check if Wwise module is loaded
bool bWwiseLoaded = FModuleManager::Get().IsModuleLoaded("LCKWwise");

// Get all loaded audio plugins
ULCKDeveloperSettings* Settings = ULCKDeveloperSettings::Get();
TArray<FLCKAudioPluginInfo> LoadedPlugins = Settings->GetLoadedAudioPlugins();

for (const FLCKAudioPluginInfo& Plugin : LoadedPlugins)
{
    UE_LOG(LogLCK, Log, TEXT("Audio plugin loaded: %s (priority %d)"), 
        *Plugin.Name, Plugin.Priority);
}
```

***

## Common Configurations

### Quest VR Game (Android)

```csharp theme={null}
PublicDependencyModuleNames.AddRange(new string[] {
    "LCKCore",
    "LCKTablet",
    "LCKUI",
    "LCKOboe"  // Low-latency mic
});
```

**Auto-loaded:** LCKVulkan, LCKAndroidEncoder, LCKAndroidGallery

***

### PC VR Game (Windows)

```csharp theme={null}
PublicDependencyModuleNames.AddRange(new string[] {
    "LCKCore",
    "LCKTablet",
    "LCKUI"
});
```

**Auto-loaded:** LCKWindowsEncoder

***

### Cross-Platform with FMOD

```csharp theme={null}
PublicDependencyModuleNames.AddRange(new string[] {
    "LCKCore",
    "LCKTablet",
    "LCKUI",
    "LCKFMOD"
});
```

***

### Multiplayer with Vivox Voice Chat

```csharp theme={null}
PublicDependencyModuleNames.AddRange(new string[] {
    "LCKCore",
    "LCKTablet",
    "LCKUI",
    "LCKVivox"  // Capture voice chat
});
```

***

## Plugin Settings UI

LCK provides a visual plugin settings UI in Project Settings:

**Location:** Project Settings → Plugins → LCK SDK → Audio Plugins

<Info>
  **What you can configure:**

  * Enable/disable audio plugins
  * Set audio priorities
  * View warnings when multiple game audio sources are enabled
</Info>

<Warning>
  If you enable multiple game audio plugins (e.g., FMOD + Wwise), LCK will show a warning. Only ONE will be active at runtime based on priority order.
</Warning>

***

## Troubleshooting

### "Module 'LCKFMOD' could not be found"

**Problem:** You enabled LCKFMOD but don't have the FMOD plugin installed.

**Solution:** Either install FMOD plugin, or remove `LCKFMOD` from your `.Build.cs` and set `"Optional": true` in `.uproject`.

***

### "LCKVulkan failed to load on Android"

**Problem:** LCKVulkan loading phase was changed or Vulkan isn't enabled.

**Solution:**

1. Verify LCKVulkan loads at `EarliestPossible` (check plugin settings)
2. Enable Vulkan in Android Project Settings → Mobile → Vulkan

***

### Multiple audio sources active

**Problem:** You have FMOD, Wwise, and UnrealAudio all enabled.

**Solution:** Only ONE game audio source can be active. Check priority order or disable unused plugins.

***

## Key Takeaways

<Check>
  **Core is required** — Always include LCKCore
</Check>

<Check>
  **Platform modules auto-load** — Don't manually enable LCKWindowsEncoder/LCKAndroidEncoder
</Check>

<Check>
  **Audio plugins are optional** — Only add what you need (FMOD, Wwise, Vivox)
</Check>

<Check>
  **One game audio source** — FMOD > Wwise > UnrealAudio priority
</Check>

<Check>
  **LCKVulkan must load early** — Never change its loading phase
</Check>

***

## Related

* [Architecture](api-reference/unreal/architecture) — System architecture overview
* [Audio Overview](unreal/audio/overview) — Audio system details
* [Types & Structs](api-reference/unreal/types) — Data structures
