> ## 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.

# Oboe (Android)

> How to use the LCKOboe plugin for high-performance, low-latency Android microphone capture in the LIV Camera Kit (LCK) SDK for Unreal Engine, using Google Oboe with AAudio and OpenSL ES support, FLCKOboeSource implementation, and FLCKOboeCallback audio stream handling on Meta Quest and other Android VR headsets.

<Info>
  **Module:** LCKOboe | **Version:** 1.0 | **Platforms:** Android only
</Info>

## Overview

LCKOboe provides high-performance, low-latency microphone capture on Android using Google's Oboe audio library. It automatically selects the optimal audio API (AAudio on Android 8.1+, OpenSL ES on older versions).

## Supported Channels

| Channel      | Supported | Description                      |
| ------------ | --------- | -------------------------------- |
| `Game`       | No        | Use FMOD or Wwise for game audio |
| `Microphone` | Yes       | Low-latency microphone capture   |
| `VoiceChat`  | No        | Use LCKVivox for voice chat      |

## Why Use LCKOboe?

<CardGroup cols={2}>
  <Card title="Lower Latency" icon="bolt">
    Significantly lower audio latency compared to Unreal's audio capture
  </Card>

  <Card title="Optimal API" icon="microchip">
    Automatically uses AAudio when available for best performance
  </Card>

  <Card title="VR Optimized" icon="vr-cardboard">
    Designed for Meta Quest and other Android VR headsets
  </Card>

  <Card title="Battery Efficient" icon="battery-full">
    Efficient native implementation reduces power consumption
  </Card>
</CardGroup>

## Dependencies

```csharp theme={null}
// Add to your .Build.cs
PublicDependencyModuleNames.AddRange(new string[] {
    "LCKOboe",
    "LCKAudio"
});
```

## Requirements

* Android 5.0+ (API 21+)
* AAudio support recommended (Android 8.1+, API 27+)
* `RECORD_AUDIO` permission

### Permissions

Add to your `AndroidManifest.xml`:

```xml theme={null}
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
```

## Source Implementation

### FLCKOboeSource

The core audio source class that captures microphone input via Google Oboe:

```cpp theme={null}
class FLCKOboeSource : public ILCKAudioSource
{
public:
    FLCKOboeSource();
    ~FLCKOboeSource();

    bool StartCapture() noexcept override;
    bool StartCapture(TLCKAudioChannelsMask Channels) noexcept override;
    void StopCapture() noexcept override;
    const FString& GetSourceName() const noexcept override;
    float GetVolume() const noexcept override;

private:
    TUniquePtr<oboe::AudioStream> InputOboeStream;
    TSharedPtr<FLCKOboeCallback, ESPMode::ThreadSafe> OboeCallback;
};
```

| Member            | Type                                                | Description                                  |
| ----------------- | --------------------------------------------------- | -------------------------------------------- |
| `InputOboeStream` | `TUniquePtr<oboe::AudioStream>`                     | The Oboe audio stream for microphone capture |
| `OboeCallback`    | `TSharedPtr<FLCKOboeCallback, ESPMode::ThreadSafe>` | Thread-safe audio data callback handler      |

### FLCKOboeCallback

Implements the Oboe audio stream callback interface. When Oboe delivers microphone samples, `FLCKOboeCallback` converts the data to 32-bit float PCM and fires `OnAudioDataDelegate` with `ELCKAudioChannel::Microphone`.

### Audio Capture Pipeline

```
┌─────────────────────────────────────────────┐
│           Android Audio HAL                  │
├─────────────────────────────────────────────┤
│  AAudio (Android 8.1+) │ OpenSL ES (older)  │
└────────────┬────────────┴────────────────────┘
             │
      ┌──────▼──────┐
      │ oboe::Audio │
      │   Stream    │
      └──────┬──────┘
             │
      ┌──────▼──────────┐
      │ FLCKOboeCallback │
      └──────┬──────────┘
             │
      ┌──────▼──────────┐
      │ FLCKOboeSource  │
      │ (Microphone)    │
      └─────────────────┘
```

## Automatic Integration

The plugin automatically:

1. Detects available audio APIs (AAudio vs OpenSL ES)
2. Selects optimal configuration for the device
3. Registers with the LCK audio system

## Configuration

### Default Settings

| Setting          | Value      |
| ---------------- | ---------- |
| Sample Rate      | 48000 Hz   |
| Channels         | Mono (1)   |
| Format           | Float32    |
| Performance Mode | LowLatency |

### Project Configuration

For Meta Quest optimization, ensure these settings in your project:

```ini theme={null}
; AndroidEngine.ini
[Audio]
AudioMixerModuleName=AudioMixerAndroid
```

## Performance Characteristics

| Device             | API       | Latency |
| ------------------ | --------- | ------- |
| Meta Quest 2/3     | AAudio    | \~20ms  |
| Quest Pro          | AAudio    | \~15ms  |
| Other Android 8.1+ | AAudio    | \~25ms  |
| Android \< 8.1     | OpenSL ES | \~40ms  |

<Tip>
  On Meta Quest devices, LCKOboe provides the lowest latency microphone capture available.
</Tip>

## Troubleshooting

<AccordionGroup>
  <Accordion title="No microphone audio">
    1. Verify `RECORD_AUDIO` permission is granted
    2. Check if another app is using the microphone
    3. Verify microphone hardware is working
    4. Confirm `AudioStream` is not null in LogLCKOboe
  </Accordion>

  <Accordion title="High latency">
    1. Ensure device supports AAudio (Android 8.1+)
    2. Check for other audio apps that might affect performance
    3. Verify Vulkan rendering is enabled
  </Accordion>

  <Accordion title="Plugin not loading">
    1. Verify plugin is enabled in .uproject
    2. Check that platform is Android
    3. Look for errors in LogLCKOboe
  </Accordion>

  <Accordion title="Stream creation failure">
    1. Check that `RECORD_AUDIO` permission is granted at runtime (not just manifest)
    2. Verify no other Oboe streams are active
    3. Check Android logcat for Oboe/AAudio errors
  </Accordion>
</AccordionGroup>

## Log Category

```cpp theme={null}
DECLARE_LOG_CATEGORY_EXTERN(LogLCKOboe, Log, All);
```

## See Also

<CardGroup cols={2}>
  <Card title="Audio Overview" icon="volume-high" href="/unreal/audio/overview">
    Audio system architecture
  </Card>

  <Card title="Unreal Audio" icon="gamepad" href="/unreal/audio/unreal-audio">
    Cross-platform audio capture
  </Card>
</CardGroup>
