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


Member Function Documentation

◆ clearBuffers()

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

Clear all the buffers from the queue.

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 

Creates a new AndroidSLESBufferQueue object.

queueObjectThe AndroidSLESObject that represent the OpenSL ES microphone and queue.
writerThe buffer writer to copy the recorded audio to.
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.

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


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

The number of buffers to use.

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

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