IVoiceInjection interface
Injects audio into the game’s OUTGOING team-voice stream (mixed with the live microphone). Backed by a process-wide native DirectSound capture hook installed by the framework at boot. Multiple sources — across all plugins — mix together into the one shared uplink.
public interface IVoiceInjectionMembers
Section titled “Members”| name | description |
|---|---|
| Available { get; } | True once the capture hook is installed AND the capture format is known (i.e. the mic is live, post-login). Audio assigned to a source before this is retained and becomes audible once true; it is simply not mixed yet. Poll or gate playback on this if you need the audio heard immediately. Read any thread; it reflects the most recent capture-format observation. |
| Status { get; } | Hook / capture-format diagnostics for status UIs and logs. Read any thread (a snapshot). |
| CreateSource() | Create an independent playback voice in the mixer. Returns null if the mixer is at capacity. Dispose it to remove it from the mixer (sources a plugin leaves open are auto-disposed on plugin teardown). Typically a plugin keeps one source for looped background audio and/or uses PlayOnce for one-shots. Main-thread only. |
| LoadFileAsync(…) | Decode an audio file off-thread (WAV natively; MP3/WMA/M4A via Windows Media Foundation) into a reusable clip. Does NOT require the capture format to be known — the clip keeps its source PCM and is (re)resampled to the capture format on demand. Throws on a missing file or an unsupported/corrupt encoding. Media Foundation is absent on Windows “N” editions → non-WAV will fail there (WAV still works). Call from any thread; the returned task completes on a background thread. |
| LoadPcm(…) | Build a clip from caller-supplied 16-bit interleaved PCM at the given sample rate and channel count. Copied immediately (the span need not outlive the call); resampled to the capture format on demand. Use for TTS or generated audio. Main-thread safe; returns at once (no decode). |
| SetUplinkPolicy(…) | Configure the GVoice uplink DSP, auto-applied while ANY source is playing and restored to the game’s defaults when all sources stop. GVoice’s noise-suppression / AGC attenuate injected (non-voice) audio, so disabling them preserves music fidelity; a higher Opus bitrate improves quality (up to the 64 kbps ceiling). The uplink encoder is process-global, so this is a single global policy — the last writer wins across plugins. A null argument leaves that setting unchanged. A disposed plugin’s policy becomes inert once its sources stop. Main-thread only (never called from the native mix hook). |
Remarks
Section titled “Remarks”The uplink encoder and the capture hook are process-global, so some state here is framework-wide (the DSP policy, the capture format) while each IVoiceSource is an independent voice. Sources a plugin creates are auto-disposed when the plugin unloads (mirroring IHarmonyHost auto-unpatch), so a plugin cannot leak a voice across a soft enable/disable cycle.
See Also
Section titled “See Also”- namespace Stellar.Abstractions.Services