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_
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::getId
size_t getId() const override
Definition: ChannelVolumeManager.cpp:92
alexaClientSDK::avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings
Definition: SpeakerInterface.h:42
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::setMute
bool setMute(bool mute) override
Definition: ChannelVolumeManager.cpp:159
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::getSpeakerType
avsCommon::sdkInterfaces::ChannelVolumeInterface::Type getSpeakerType() const override
Definition: ChannelVolumeManager.cpp:87
alexaClientSDK::avsCommon::sdkInterfaces::ChannelVolumeInterface::Type::AVS_SPEAKER_VOLUME
@ AVS_SPEAKER_VOLUME
Volume type reflecting AVS Speaker API volume.
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::startDucking
bool startDucking() override
Definition: ChannelVolumeManager.cpp:96
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::getSpeakerSettings
bool getSpeakerSettings(avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings *settings) const override
Definition: ChannelVolumeManager.cpp:165
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager
Definition: ChannelVolumeManager.h:30
alexaClientSDK::avsCommon::sdkInterfaces::ChannelVolumeInterface
Definition: ChannelVolumeInterface.h:32
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::setUnduckedVolume
bool setUnduckedVolume(int8_t volume) override
Definition: ChannelVolumeManager.cpp:139
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::create
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
alexaClientSDK::capabilityAgents::speakerManager::ChannelVolumeManager::stopDucking
bool stopDucking() override
Definition: ChannelVolumeManager.cpp:120
alexaClientSDK::avsCommon::sdkInterfaces::ChannelVolumeInterface::Type
Type
Definition: ChannelVolumeInterface.h:37
ChannelVolumeInterface.h

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