Skip to content

Class Tryll::VoiceInput

ClassList > Tryll > VoiceInput

More...

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

using Tryll::VoiceInput::TranscriptCallback = std::function<void(const TranscriptUpdate&)>;

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

std::future< void > Tryll::VoiceInput::BeginUtteranceAsync (
    UtteranceOptions opts={}
) 


function CancelUtterance

void Tryll::VoiceInput::CancelUtterance (
    std::chrono::milliseconds timeout=std::chrono::seconds{10}
) 

function CancelUtteranceAsync

Cancel the utterance without producing a transcript.

std::future< void > Tryll::VoiceInput::CancelUtteranceAsync () 


function EndUtterance

void Tryll::VoiceInput::EndUtterance (
    std::chrono::milliseconds timeout=std::chrono::seconds{60}
) 

function EndUtteranceAsync

std::future< void > Tryll::VoiceInput::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).

std::uint64_t Tryll::VoiceInput::GetVoiceInputId () noexcept const


function IsUtteranceActive

True if BeginUtterance has been called and the utterance is not yet complete.

bool Tryll::VoiceInput::IsUtteranceActive () noexcept const


function SendAudioBuffer

void Tryll::VoiceInput::SendAudioBuffer (
    std::span< const std::int16_t > pcm
) 

Push a block of mono int16 PCM samples to the server. Fire-and-forget (no ack expected). Thread-safe.


function SetOnTranscriptUpdate

void Tryll::VoiceInput::SetOnTranscriptUpdate (
    TranscriptCallback cb
) 

Register a callback for transcript updates. Called on the reader thread — keep brief and non-blocking. Pass nullptr to clear.


function VoiceInput [1/3]

Tryll::VoiceInput::VoiceInput (
    const VoiceInput &
) = delete

function VoiceInput [2/3]

Tryll::VoiceInput::VoiceInput (
    VoiceInput &&
) noexcept

function operator=

VoiceInput & Tryll::VoiceInput::operator= (
    const VoiceInput &
) = delete

function operator=

VoiceInput & Tryll::VoiceInput::operator= (
    VoiceInput &&
) noexcept

function ~VoiceInput

Implicitly cancels any active utterance and destroys the server-side handle.

Tryll::VoiceInput::~VoiceInput () 



The documentation for this class was generated from the following file C:/_tryll/_monorepo2/server/client-cpp/include/tryll/VoiceInput.h