AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::speechencoder::SpeechEncoder Class Reference

#include <SpeechEncoder.h>

Public Member Functions

 SpeechEncoder (const std::shared_ptr< EncoderContext > &encoder)
 ~SpeechEncoder ()
bool startEncoding (const std::shared_ptr< alexaClientSDK::avsCommon::avs::AudioInputStream > &inputStream, alexaClientSDK::avsCommon::utils::AudioFormat inputFormat, avsCommon::avs::AudioInputStream::Index begin, avsCommon::avs::AudioInputStream::Reader::Reference reference)
void stopEncoding (bool stopImmediately=false)
std::shared_ptr< alexaClientSDK::avsCommon::avs::AudioInputStreamgetEncodedStream ()
std::shared_ptr< EncoderContextgetContext ()

Static Public Member Functions

static std::shared_ptr< SpeechEncodercreateSpeechEncoder (const std::shared_ptr< EncoderContext > &encoder)

Detailed Description

This class provides generic interface between backend encoder implementation and the application who wants to encode audio stream within AudioInputStream

Constructor & Destructor Documentation

◆ SpeechEncoder()

alexaClientSDK::speechencoder::SpeechEncoder::SpeechEncoder ( const std::shared_ptr< EncoderContext > &  encoder)


encoderThe backend encoder implmentation.

◆ ~SpeechEncoder()

alexaClientSDK::speechencoder::SpeechEncoder::~SpeechEncoder ( )


Member Function Documentation

◆ createSpeechEncoder()

std::shared_ptr< SpeechEncoder > alexaClientSDK::speechencoder::SpeechEncoder::createSpeechEncoder ( const std::shared_ptr< EncoderContext > &  encoder)

Factory method.

encoderThe backend encoder implmentation.

◆ getContext()

std::shared_ptr< EncoderContext > alexaClientSDK::speechencoder::SpeechEncoder::getContext ( )

Retrieve a EncoderContext that was given with initialization.


◆ getEncodedStream()

std::shared_ptr< AudioInputStream > alexaClientSDK::speechencoder::SpeechEncoder::getEncodedStream ( )

Retrieve AudioInputStream for encoding results.

AudioInputStream for streaming encoding results for further processing.

◆ startEncoding()

bool alexaClientSDK::speechencoder::SpeechEncoder::startEncoding ( const std::shared_ptr< alexaClientSDK::avsCommon::avs::AudioInputStream > &  inputStream,
alexaClientSDK::avsCommon::utils::AudioFormat  inputFormat,
avsCommon::avs::AudioInputStream::Index  begin,
avsCommon::avs::AudioInputStream::Reader::Reference  reference 

Start the new encoding session. SpeechEncoder can manage only single session at the same time, thus this call will be failed when ongoing encoding session exists, or pre-initialization on EncoderContext is failed.

inputStreamThe AudioInputStream to stream audio from. (i.e. input stream that has raw PCM frames.)
inputFormatThe AudioFormat to describe the audio format of the input stream.
beginThe index where encoding should begin.
referenceThe reference for the index.
true if encoding session has been started successfully, otherwise false.

◆ stopEncoding()

void alexaClientSDK::speechencoder::SpeechEncoder::stopEncoding ( bool  stopImmediately = false)

Stop current encoding session.

stopImmediatelyFlag indicating that encoding should stop immediatly. If this flag is set to false (the default), encoding will continue until any existing data in the buffer has been encoded. If this flag is set to true, existing data in the buffer which has not already been encoded will be discarded, and encoding will stop immediately.

The documentation for this class was generated from the following files:

AlexaClientSDK 1.26.0 - Copyright 2016-2022, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0