AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ChannelVolumeInterface.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_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CHANNELVOLUMEINTERFACE_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CHANNELVOLUMEINTERFACE_H_
18 
19 #include <functional>
22 
23 namespace alexaClientSDK {
24 namespace avsCommon {
25 namespace sdkInterfaces {
26 
33 public:
37  enum class Type {
42  };
43 
52  virtual bool startDucking() = 0;
53 
60  virtual bool stopDucking() = 0;
61 
72  virtual bool setUnduckedVolume(int8_t volume) = 0;
73 
83  virtual bool adjustUnduckedVolume(int8_t delta);
84 
91  virtual bool setMute(bool mute) = 0;
92 
104 
110  virtual Type getSpeakerType() const = 0;
111 
117  virtual std::size_t getId() const {
118  return std::size_t(this);
119  };
120 
124  virtual ~ChannelVolumeInterface() = default;
125 };
126 
134 inline std::ostream& operator<<(std::ostream& stream, ChannelVolumeInterface::Type type) {
135  switch (type) {
137  stream << "AVS_SPEAKER_VOLUME";
138  return stream;
140  stream << "AVS_ALERTS_VOLUME";
141  return stream;
142  }
143  stream << "UNKNOWN_CHANNEL_VOLUME_TYPE";
144  return stream;
145 }
146 
150  return false;
151  }
152  if (0 == delta) {
154  return true;
155  }
157  if (!getSpeakerSettings(&settings)) {
158  return false;
159  }
160  int volume = static_cast<int>(settings.volume) + static_cast<int>(delta);
165  }
166  return setUnduckedVolume(static_cast<int8_t>(volume));
167 }
168 
169 } // namespace sdkInterfaces
170 } // namespace avsCommon
171 } // namespace alexaClientSDK
172 
173 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CHANNELVOLUMEINTERFACE_H_
virtual std::size_t getId() const
Definition: ChannelVolumeInterface.h:117
const int8_t AVS_SET_VOLUME_MAX
AVS setVolume Maximum.
Definition: SpeakerConstants.h:33
std::ostream & operator<<(std::ostream &stream, const AudioInputProcessorObserverInterface::State &state)
Definition: AudioInputProcessorObserverInterface.h:94
const int8_t AVS_ADJUST_VOLUME_MAX
AVS adjustVolume Maximum.
Definition: SpeakerConstants.h:39
virtual bool getSpeakerSettings(avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings *settings) const =0
const int8_t AVS_ADJUST_VOLUME_MIN
AVS adjustVolume Minimum.
Definition: SpeakerConstants.h:36
const int8_t AVS_SET_VOLUME_MIN
AVS setVolume Minimum.
Definition: SpeakerConstants.h:30
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
int8_t volume
Must be within [AVS_SET_VOLUME_MIN, AVS_SET_VOLUME_MAX].
Definition: SpeakerInterface.h:44
type
Definition: upload.py:443
virtual bool adjustUnduckedVolume(int8_t delta)
Definition: ChannelVolumeInterface.h:147

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