AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AudioProvider.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_AIP_INCLUDE_AIP_AUDIOPROVIDER_H_
17 #define ALEXA_CLIENT_SDK_CAPABILITYAGENTS_AIP_INCLUDE_AIP_AUDIOPROVIDER_H_
18 
21 #include "ASRProfile.h"
22 
23 namespace alexaClientSDK {
24 namespace capabilityAgents {
25 namespace aip {
26 
31 struct AudioProvider {
45  std::shared_ptr<avsCommon::avs::AudioInputStream> stream,
48  bool alwaysReadable,
49  bool canOverride,
50  bool canBeOverridden);
51 
57  static const AudioProvider& null();
58 
65  operator bool() const;
66 
68  std::shared_ptr<avsCommon::avs::AudioInputStream> stream;
69 
72 
75 
78 
81 
84 };
85 
87  std::shared_ptr<avsCommon::avs::AudioInputStream> stream,
90  bool alwaysReadable,
91  bool canOverride,
92  bool canBeOverridden)
93  // Note: There is an issue with braced initialization of an aggregate type in GCC 4.8, so parentheses are used
94  // below to initialize format.
95  :
96  stream{stream},
97  format(format),
102 }
103 
105  static AudioProvider nullAudioProvider{nullptr,
108  0,
109  0,
110  0,
111  true,
114  false,
115  false,
116  false};
117  return nullAudioProvider;
118 }
119 
120 inline AudioProvider::operator bool() const {
121  return stream != nullptr;
122 }
123 
124 } // namespace aip
125 } // namespace capabilityAgents
126 } // namespace alexaClientSDK
127 
128 #endif // ALEXA_CLIENT_SDK_CAPABILITYAGENTS_AIP_INCLUDE_AIP_AUDIOPROVIDER_H_
AudioProvider(std::shared_ptr< avsCommon::avs::AudioInputStream > stream, const avsCommon::utils::AudioFormat &format, ASRProfile profile, bool alwaysReadable, bool canOverride, bool canBeOverridden)
Definition: AudioProvider.h:86
bool canBeOverridden
Whether this AudioProvider should allow another AudioProvider to interrupt it.
Definition: AudioProvider.h:83
avsCommon::utils::AudioFormat format
The AudioFormat of the data in byteStream.
Definition: AudioProvider.h:71
Non-Interleaved : The L and R are separated in different streams.
static const AudioProvider & null()
Definition: AudioProvider.h:104
bool canOverride
Whether this AudioProvider should be allowed to interrupt/override another AudioProvider.
Definition: AudioProvider.h:80
Represents LPCM (Linear pulse code modulation) encoding.
ASRProfile profile
The ASRProfile describing the acoustic environment for the audio input.
Definition: AudioProvider.h:74
bool alwaysReadable
Whether new audio data can be read at any time from byteStream.
Definition: AudioProvider.h:77
ASRProfile
Definition: ASRProfile.h:31
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::shared_ptr< avsCommon::avs::AudioInputStream > stream
The ByteStream to use for audio input.
Definition: AudioProvider.h:68
Client determines end of user speech (0 to 2.5 ft).

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