Core Classes - Sanas Developer Hub
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Your application interacts with two interfaces: IRemoteSDK (created once per process) and IAudioProcessor (one per live audio stream).
IRemoteSDK
The top-level object. Create one per process with the CreateRemoteSDK() factory, initialise it once, then use it to create and destroy audio processors.
| Method | Signature | Description |
|---|---|---|
Initialize |
InitSDKResult Initialize(const InitParams&) |
Authenticate and connect. Call once; a second call returns kAlreadyInitialized. |
CreateAudioProcessor |
shared_ptr<IAudioProcessor> CreateAudioProcessor(const AudioParams&, CreateProcessorResult&, ProcessorStateCallback, TranscriptCallback) |
Open a stream. Starts in kInitializing and transitions to kReady asynchronously. The state and transcript callbacks are optional. |
DestroyAudioProcessor |
DestroyProcessorResult DestroyAudioProcessor(shared_ptr<IAudioProcessor>) |
Close a stream and release its resources. |
Shutdown |
ShutdownSDKResult Shutdown() |
Release the SDK. Destroys any processors you forgot to release. Call last. |
IsInitialized |
bool IsInitialized() |
Whether Initialize has succeeded. |
GetActiveProcessorCount |
size_t GetActiveProcessorCount() |
Number of live processors. |
auto sdk = CreateRemoteSDK(); // factory function
InitParams init; init.apiKey = "...";
sdk->Initialize(init);
// ... create processors ...
sdk->Shutdown();
sanas::remote::GetSDKVersion() is a free function (returns const char*) available without an SDK instance.
IAudioProcessor
Represents one live audio stream. Create one per concurrent call or session; each runs independently.
| Method | Signature | Description |
|---|---|---|
ProcessSamples |
void ProcessSamples(const std::vector<float>& in, std::vector<float>& out) |
Send one frame of audio and receive the processed frame. Synchronous — blocks for one frame. Only call when kReady. |
GetState |
ProcessorState GetState() |
Current state, checked instantly. |
GetNextStateChange |
bool GetNextStateChange(ProcessorStateChange&) |
Drain the next queued state change (non-blocking). Returns false when the queue is empty. |
WaitForStateChange |
bool WaitForStateChange(ProcessorStateChange&, int timeoutMs) |
Block until the next state change or timeout. Use a dedicated monitor thread — never the audio thread. |
UpdateLanguageConfig |
UpdateLanguageResult UpdateLanguageConfig(const LanguageConfig&) |
Switch the source/target language pair on a kReady processor without reconnecting. |
Keep the shared_ptr<IAudioProcessor> alive for as long as you use the processor, and never call DestroyAudioProcessor or Shutdown from inside a callback — see Threading & Lifetime Rules.