AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AndroidSLESMicrophone.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_APPLICATIONUTILITIES_ANDROIDUTILITIES_INCLUDE_ANDROIDUTILITIES_ANDROIDSLESMICROPHONE_H_
17 #define ALEXA_CLIENT_SDK_APPLICATIONUTILITIES_ANDROIDUTILITIES_INCLUDE_ANDROIDUTILITIES_ANDROIDSLESMICROPHONE_H_
18 
19 #include <memory>
20 #include <SLES/OpenSLES.h>
21 
26 
27 namespace alexaClientSDK {
28 namespace applicationUtilities {
29 namespace androidUtilities {
30 
31 class AndroidSLESBufferQueue;
32 
43 public:
51  static std::unique_ptr<AndroidSLESMicrophone> create(
52  std::shared_ptr<AndroidSLESEngine> engine,
53  std::shared_ptr<avsCommon::avs::AudioInputStream> stream);
54 
61 
64  bool stopStreamingMicrophoneData() override;
65  bool startStreamingMicrophoneData() override;
66  bool isStreaming() override;
68 
79  static SLDataSink createSinkConfiguration();
80 
86  static SLDataSource createSourceConfiguration();
87 
92 
93 private:
101  std::shared_ptr<AndroidSLESEngine> engine,
102  std::shared_ptr<avsCommon::avs::AudioInputStream::Writer> writer);
103 
106  std::shared_ptr<AndroidSLESEngine> m_engineObject;
107 
109  std::shared_ptr<avsCommon::avs::AudioInputStream::Writer> m_writer;
110 
112  std::shared_ptr<AndroidSLESObject> m_recorderObject;
113 
115  SLRecordItf m_recorderInterface;
116 
118  std::unique_ptr<AndroidSLESBufferQueue> m_queue;
119 
121  std::mutex m_mutex;
122 
124  bool m_isStreaming;
125 };
126 
127 } // namespace androidUtilities
128 } // namespace applicationUtilities
129 } // namespace alexaClientSDK
130 
131 #endif // ALEXA_CLIENT_SDK_APPLICATIONUTILITIES_ANDROIDUTILITIES_INCLUDE_ANDROIDUTILITIES_ANDROIDSLESMICROPHONE_H_
static std::unique_ptr< AndroidSLESMicrophone > create(std::shared_ptr< AndroidSLESEngine > engine, std::shared_ptr< avsCommon::avs::AudioInputStream > stream)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
This acts as an interface to record audio input from a microphone.
Definition: MicrophoneInterface.h:28

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