AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AndroidSLESEngine.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 #ifndef ALEXA_CLIENT_SDK_APPLICATIONUTILITIES_ANDROIDUTILITIES_INCLUDE_ANDROIDUTILITIES_ANDROIDSLESENGINE_H_
16 #define ALEXA_CLIENT_SDK_APPLICATIONUTILITIES_ANDROIDUTILITIES_INCLUDE_ANDROIDUTILITIES_ANDROIDSLESENGINE_H_
17 
18 #include <SLES/OpenSLES.h>
19 #include <memory>
20 
23 
24 namespace alexaClientSDK {
25 namespace applicationUtilities {
26 namespace androidUtilities {
27 
28 class AndroidSLESMicrophone;
29 
38 class AndroidSLESEngine : public std::enable_shared_from_this<AndroidSLESEngine> {
39 public:
45  static std::shared_ptr<AndroidSLESEngine> create();
46 
53  std::unique_ptr<AndroidSLESMicrophone> createAndroidMicrophone(
54  std::shared_ptr<avsCommon::avs::AudioInputStream> stream);
55 
61  std::unique_ptr<AndroidSLESObject> createAudioRecorder();
62 
68  void createAudioRecorder(SLObjectItf& recorderObject);
69 
79  std::unique_ptr<AndroidSLESObject> createPlayer(SLDataSource& source, SLDataSink& sink, bool requireEqualizer)
80  const;
81 
87  std::unique_ptr<AndroidSLESObject> createOutputMix() const;
88 
93 
94 private:
101  AndroidSLESEngine(std::unique_ptr<AndroidSLESObject> object, SLEngineItf engine);
102 
104  std::unique_ptr<AndroidSLESObject> m_object;
105 
107  SLEngineItf m_engine;
108 
110  static std::atomic_flag m_created;
111 };
112 
113 } // namespace androidUtilities
114 } // namespace applicationUtilities
115 } // namespace alexaClientSDK
116 
117 #endif // ALEXA_CLIENT_SDK_APPLICATIONUTILITIES_ANDROIDUTILITIES_INCLUDE_ANDROIDUTILITIES_ANDROIDSLESENGINE_H_
std::unique_ptr< AndroidSLESObject > createOutputMix() const
Definition: AndroidSLESEngine.cpp:104
std::unique_ptr< AndroidSLESMicrophone > createAndroidMicrophone(std::shared_ptr< avsCommon::avs::AudioInputStream > stream)
Definition: AndroidSLESEngine.cpp:82
std::unique_ptr< AndroidSLESObject > createPlayer(SLDataSource &source, SLDataSink &sink, bool requireEqualizer) const
Definition: AndroidSLESEngine.cpp:116
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::shared_ptr< AndroidSLESEngine > create()
Definition: AndroidSLESEngine.cpp:42
std::unique_ptr< AndroidSLESObject > createAudioRecorder()
Definition: AndroidSLESEngine.cpp:89

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