AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
alexaClientSDK::applicationUtilities::androidUtilities::AndroidSLESBufferQueue Class Reference

#include <AndroidSLESBufferQueue.h>

Public Member Functions

void onBufferCompleted ()
 
bool enqueueBuffers ()
 
bool clearBuffers ()
 
 ~AndroidSLESBufferQueue ()
 

Static Public Member Functions

static std::unique_ptr< AndroidSLESBufferQueuecreate (std::shared_ptr< AndroidSLESObject > queueObject, std::shared_ptr< avsCommon::avs::AudioInputStream::Writer > writer)
 

Static Public Attributes

static constexpr uint32_t NUMBER_OF_BUFFERS {2u}
 The number of buffers to use. More...
 

Detailed Description

Class responsible for consuming data produced from an AndroidSLESObject.

For that, it keeps a circular buffer queue that it feeds to the OpenSL ES microphone. When the microphone is recording it should call enqueueBuffers to enqueue all free buffers to the OpenSL ES object.

Whenever the OpenSL ES microphone fills up a buffer, it calls the onBufferCompleted method, which will copy the recorded data to the AudioInputStream and enqueue the same buffer back.

When recording is stopped, clearBuffers can be used to clear all buffers with any previously recorded data.

Constructor & Destructor Documentation

◆ ~AndroidSLESBufferQueue()

alexaClientSDK::applicationUtilities::androidUtilities::AndroidSLESBufferQueue::~AndroidSLESBufferQueue ( )

Destructor.

Member Function Documentation

◆ clearBuffers()

bool alexaClientSDK::applicationUtilities::androidUtilities::AndroidSLESBufferQueue::clearBuffers ( )

Clear all the buffers from the queue.

Returns
true if succeeds and false otherwise.

◆ create()

static std::unique_ptr<AndroidSLESBufferQueue> alexaClientSDK::applicationUtilities::androidUtilities::AndroidSLESBufferQueue::create ( std::shared_ptr< AndroidSLESObject queueObject,
std::shared_ptr< avsCommon::avs::AudioInputStream::Writer >  writer 
)
static

Creates a new AndroidSLESBufferQueue object.

Parameters
queueObjectThe AndroidSLESObject that represent the OpenSL ES microphone and queue.
writerThe buffer writer to copy the recorded audio to.
Returns
Pointer to the new object if object could be successfully created; otherwise, return a nullptr.

◆ enqueueBuffers()

bool alexaClientSDK::applicationUtilities::androidUtilities::AndroidSLESBufferQueue::enqueueBuffers ( )

Add all free buffers into the queue.

Returns
true if succeeds and false otherwise.

◆ onBufferCompleted()

void alexaClientSDK::applicationUtilities::androidUtilities::AndroidSLESBufferQueue::onBufferCompleted ( )

The callback function to be called when a buffer has been filled with recorded data. This function will copy the data out of the filled buffer into its AudioInputStream.

Member Data Documentation

◆ NUMBER_OF_BUFFERS

constexpr uint32_t alexaClientSDK::applicationUtilities::androidUtilities::AndroidSLESBufferQueue::NUMBER_OF_BUFFERS {2u}
static

The number of buffers to use.


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

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