AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ChannelVolumeManager.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_CAPABILITYAGENTS_SPEAKERMANAGER_INCLUDE_SPEAKERMANAGER_CHANNELVOLUMEMANAGER_H_
17 #define ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SPEAKERMANAGER_INCLUDE_SPEAKERMANAGER_CHANNELVOLUMEMANAGER_H_
18 
20 #include <mutex>
21 
22 namespace alexaClientSDK {
23 namespace capabilityAgents {
24 namespace speakerManager {
31 public:
40  static std::shared_ptr<ChannelVolumeManager> create(
41  std::shared_ptr<avsCommon::sdkInterfaces::SpeakerInterface> speaker,
44  std::function<int8_t(int8_t)> volumeCurve = nullptr);
45 
49  size_t getId() const override;
50  bool startDucking() override;
51  bool stopDucking() override;
52  bool setUnduckedVolume(int8_t volume) override;
53  bool setMute(bool mute) override;
56 
57 private:
65  using VolumeCurveFunction = std::function<int8_t(int8_t unduckedVolume)>;
66 
74  std::shared_ptr<avsCommon::sdkInterfaces::SpeakerInterface> speaker,
76  VolumeCurveFunction volumeCurve);
77 
97  static int8_t defaultVolumeAttenuateFunction(int8_t unduckedVolume);
98 
100  mutable std::mutex m_mutex;
101 
103  std::shared_ptr<avsCommon::sdkInterfaces::SpeakerInterface> m_speaker;
104 
106  bool m_isDucked;
107 
109  int8_t m_unduckedVolume;
110 
112  VolumeCurveFunction m_volumeCurveFunction;
113 
116 };
117 } // namespace speakerManager
118 } // namespace capabilityAgents
119 } // namespace alexaClientSDK
120 
121 #endif // ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SPEAKERMANAGER_INCLUDE_SPEAKERMANAGER_CHANNELVOLUMEMANAGER_H_
bool stopDucking() override
Definition: ChannelVolumeManager.cpp:120
bool getSpeakerSettings(avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings *settings) const override
Definition: ChannelVolumeManager.cpp:165
bool startDucking() override
Definition: ChannelVolumeManager.cpp:96
avsCommon::sdkInterfaces::ChannelVolumeInterface::Type getSpeakerType() const override
Definition: ChannelVolumeManager.cpp:87
size_t getId() const override
Definition: ChannelVolumeManager.cpp:92
static std::shared_ptr< ChannelVolumeManager > create(std::shared_ptr< avsCommon::sdkInterfaces::SpeakerInterface > speaker, avsCommon::sdkInterfaces::ChannelVolumeInterface::Type type=avsCommon::sdkInterfaces::ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME, std::function< int8_t(int8_t)> volumeCurve=nullptr)
Definition: ChannelVolumeManager.cpp:52
bool setMute(bool mute) override
Definition: ChannelVolumeManager.cpp:159
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
bool setUnduckedVolume(int8_t volume) override
Definition: ChannelVolumeManager.cpp:139

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