AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AndroidSLESSpeaker.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_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_ANDROIDSLESSPEAKER_H_
16 #define ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_ANDROIDSLESSPEAKER_H_
17 
18 #include <memory>
19 #include <mutex>
20 #include <utility>
21 
22 #include <SLES/OpenSLES.h>
23 
27 
28 namespace alexaClientSDK {
29 namespace mediaPlayer {
30 namespace android {
31 
39 public:
48  static std::unique_ptr<AndroidSLESSpeaker> create(
49  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESEngine> engine,
50  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESObject> outputMixObject,
51  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESObject> speakerObject);
52 
55  bool setVolume(int8_t volume) override;
56  bool setMute(bool mute) override;
57  bool getSpeakerSettings(SpeakerSettings* settings) override;
59 
60 private:
70  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESEngine> engine,
71  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESObject> outputMixObject,
72  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESObject> speakerObject,
73  SLVolumeItf volumeInterface);
74 
80  std::pair<bool, int8_t> getAvsVolume() const;
81 
88  int8_t toAvsVolume(SLmillibel deviceVolume) const;
89 
96  SLmillibel toDeviceVolume(int8_t avsVolume) const;
97 
100  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESEngine> m_engine;
101 
103  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESObject> m_outputMixObject;
104 
107  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESObject> m_speakerObject;
108 
110  SLVolumeItf m_volumeInterface;
111 };
112 
113 } // namespace android
114 } // namespace mediaPlayer
115 } // namespace alexaClientSDK
116 
117 #endif // ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_ANDROIDSLESSPEAKER_H_
static std::unique_ptr< AndroidSLESSpeaker > create(std::shared_ptr< applicationUtilities::androidUtilities::AndroidSLESEngine > engine, std::shared_ptr< applicationUtilities::androidUtilities::AndroidSLESObject > outputMixObject, std::shared_ptr< applicationUtilities::androidUtilities::AndroidSLESObject > speakerObject)
bool getSpeakerSettings(SpeakerSettings *settings) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36

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