Class Tryll::VoiceInput¶
ClassList > Tryll > VoiceInput
#include <VoiceInput.h>
Public Types¶
| Type | Name |
|---|---|
| typedef std::function< void(const TranscriptUpdate &)> | TranscriptCallback |
Public Functions¶
| Type | Name |
|---|---|
| void | BeginUtterance (UtteranceOptions opts={}, std::chrono::milliseconds timeout=std::chrono::seconds{10}) |
| std::future< void > | BeginUtteranceAsync (UtteranceOptions opts={}) Open a new utterance. Rejects if one is already active (throws TryllError ). |
| void | CancelUtterance (std::chrono::milliseconds timeout=std::chrono::seconds{10}) |
| std::future< void > | CancelUtteranceAsync () Cancel the utterance without producing a transcript. |
| void | EndUtterance (std::chrono::milliseconds timeout=std::chrono::seconds{60}) |
| std::future< void > | EndUtteranceAsync () |
| std::uint64_t | GetVoiceInputId () noexcept const The server-assigned handle id (zero before the handle is valid). |
| bool | IsUtteranceActive () noexcept const True if BeginUtterance has been called and the utterance is not yet complete. |
| void | SendAudioBuffer (std::span< const std::int16_t > pcm) |
| void | SetOnTranscriptUpdate (TranscriptCallback cb) |
| VoiceInput (const VoiceInput &) = delete |
|
| VoiceInput (VoiceInput &&) noexcept |
|
| VoiceInput & | operator= (const VoiceInput &) = delete |
| VoiceInput & | operator= (VoiceInput &&) noexcept |
| ~VoiceInput () Implicitly cancels any active utterance and destroys the server-side handle. |
Detailed Description¶
Move-only handle to a server-side VoiceInput session.
Obtained via TryllClient::CreateVoiceInput or CreateVoiceInputAsync.
Lifetime guarantee: the destructor issues an implicit CancelUtterance (if active) followed by DestroyVoiceInput so the server-side ISttSession is always cleaned up. Move the handle to extend its lifetime.
Thread-safety: this handle is NOT internally synchronized. All public methods — including SendAudioBuffer — must be called from the same thread, or the caller must provide external synchronization. Moving or destroying the handle must likewise be serialized with any concurrent method calls.
Public Types Documentation¶
typedef TranscriptCallback¶
Public Functions Documentation¶
function BeginUtterance¶
void Tryll::VoiceInput::BeginUtterance (
UtteranceOptions opts={},
std::chrono::milliseconds timeout=std::chrono::seconds{10}
)
function BeginUtteranceAsync¶
Open a new utterance. Rejects if one is already active (throws TryllError ).
function CancelUtterance¶
void Tryll::VoiceInput::CancelUtterance (
std::chrono::milliseconds timeout=std::chrono::seconds{10}
)
function CancelUtteranceAsync¶
Cancel the utterance without producing a transcript.
function EndUtterance¶
function EndUtteranceAsync¶
Commit the utterance (push-to-talk release). The engine drains pending audio, decodes, and delivers the final TranscriptUpdate.
function GetVoiceInputId¶
The server-assigned handle id (zero before the handle is valid).
function IsUtteranceActive¶
True if BeginUtterance has been called and the utterance is not yet complete.
function SendAudioBuffer¶
Push a block of mono int16 PCM samples to the server. Fire-and-forget (no ack expected). Thread-safe.
function SetOnTranscriptUpdate¶
Register a callback for transcript updates. Called on the reader thread — keep brief and non-blocking. Pass nullptr to clear.
function VoiceInput [1/3]¶
function VoiceInput [2/3]¶
function operator=¶
function operator=¶
function ~VoiceInput¶
Implicitly cancels any active utterance and destroys the server-side handle.
The documentation for this class was generated from the following file C:/_tryll/_monorepo2/server/client-cpp/include/tryll/VoiceInput.h