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

# Vivox

> API reference for FLCKVivoxSource, the dual-channel audio source that captures microphone and voice chat audio through Vivox callbacks.

<Info>
  **Module:** LCKVivox | **Version:** 1.0 | **Platforms:** All
</Info>

## Overview

LCKVivox integrates with the Vivox voice chat SDK to capture both outgoing microphone audio and incoming voice chat audio. It uses Vivox's audio callbacks and thread-safe atomics for lock-free data handoff between the Vivox audio thread and the game thread.

## Supported Channels

| Channel      | Supported | Description                                                   |
| ------------ | --------- | ------------------------------------------------------------- |
| `Game`       | Yes       | Incoming voice chat audio (mapped from Vivox render callback) |
| `Microphone` | Yes       | Outgoing mic audio (mapped from Vivox capture callback)       |
| `VoiceChat`  | No        | Not used — Vivox audio mapped to Game/Microphone channels     |

***

## FLCKVivoxSource

Audio source class that captures microphone and voice chat audio through Vivox SDK callbacks. Implements `ILCKFeatureInstance` with dual-channel support.

```cpp theme={null}
class FLCKVivoxSource : 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 CaptureChannels =
        ELCKAudioChannel::Game | ELCKAudioChannel::Microphone;
};
```

### ILCKFeatureInstance Methods

| Method                   | Behavior                                                            |
| ------------------------ | ------------------------------------------------------------------- |
| `StartCapture()`         | Registers Vivox capture and render callbacks for mic and voice chat |
| `StartCapture(Channels)` | Registers callbacks for the specified channel mask only             |
| `StopCapture()`          | Unregisters all Vivox callbacks and stops capture                   |
| `GetVolume()`            | Returns current RMS volume across active channels (0.0-1.0)         |
| `GetSourceName()`        | Returns `"LCKVivox"`                                                |

### Thread Safety

`FLCKVivoxSource` uses atomic operations for lock-free data exchange between threads:

* Vivox audio callbacks run on a dedicated Vivox audio thread
* Audio data is written to an atomic buffer by the callback
* The game thread reads from the atomic buffer when `StereoMix` is called
* No mutex contention on the audio hot path

```cpp theme={null}
// Internal threading model (simplified)
// Vivox thread: writes PCM data via atomic swap
// Game thread:  reads PCM data via atomic swap
// No locks on the audio path
```

***

## FLCKVivoxModule

Module that manages the lifecycle of `FLCKVivoxSource`.

```cpp theme={null}
class FLCKVivoxModule : public IModuleInterface
{
public:
    virtual void StartupModule() override;
    virtual void ShutdownModule() override;

private:
    TSharedPtr<FLCKVivoxSource> FeatureInstance;
};

IMPLEMENT_MODULE(FLCKVivoxModule, LCKVivox)
```

On startup, the module creates an `FLCKVivoxSource` and registers it as a modular feature. On shutdown, it unregisters Vivox callbacks, unregisters the modular feature, and destroys the source.

<Warning>
  LCKVivox requires the Vivox plugin to be installed and configured in your project. The module will not load if the Vivox SDK is unavailable.
</Warning>

***

## Log Category

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

***

## Related

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

  <Card title="ILCKFeatureInstance" icon="microphone" href="/api-reference/unreal/audio-source-interface">
    Full interface specification
  </Card>
</CardGroup>
