AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AudioFormat.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 
19 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_AUDIOFORMAT_H_
20 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_AUDIOFORMAT_H_
21 
22 #include <ostream>
23 
24 namespace alexaClientSDK {
25 namespace avsCommon {
26 namespace utils {
27 
31 struct AudioFormat {
35  enum class Encoding {
37  LPCM,
38 
40  OPUS
41  };
42 
46  enum class Layout {
49 
52  };
53 
57  enum class Endianness {
59  LITTLE,
60 
62  BIG
63  };
64 
67 
70 
72  unsigned int sampleRateHz;
73 
75  unsigned int sampleSizeInBits;
76 
78  unsigned int numChannels;
79 
81  bool dataSigned;
82 
85 };
86 
94 inline std::ostream& operator<<(std::ostream& stream, const AudioFormat::Encoding& encoding) {
95  switch (encoding) {
97  stream << "LPCM";
98  break;
100  stream << "OPUS";
101  break;
102  }
103  return stream;
104 }
105 
113 inline std::ostream& operator<<(std::ostream& stream, const AudioFormat::Endianness& endianness) {
114  switch (endianness) {
116  stream << "LITTLE";
117  break;
119  stream << "BIG";
120  break;
121  }
122  return stream;
123 }
124 
125 } // namespace utils
126 } // namespace avsCommon
127 } // namespace alexaClientSDK
128 
129 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_AUDIOFORMAT_H_
alexaClientSDK::avsCommon::utils::AudioFormat::sampleSizeInBits
unsigned int sampleSizeInBits
The bits per sample.
Definition: AudioFormat.h:75
alexaClientSDK::avsCommon::utils::AudioFormat::Layout::INTERLEAVED
@ INTERLEAVED
Interleaved : The L and R sides of a stereo recording are interleaved.
alexaClientSDK::avsCommon::utils::AudioFormat
Definition: AudioFormat.h:31
alexaClientSDK::avsCommon::utils::AudioFormat::Encoding
Encoding
Definition: AudioFormat.h:35
alexaClientSDK::avsCommon::utils::AudioFormat::Endianness::LITTLE
@ LITTLE
Represents little endianness.
alexaClientSDK::avsCommon::utils::AudioFormat::Encoding::OPUS
@ OPUS
Represents OPUS encoding.
alexaClientSDK::avsCommon::utils::AudioFormat::Endianness
Endianness
Definition: AudioFormat.h:57
alexaClientSDK::avsCommon::utils::AudioFormat::layout
Layout layout
The layout of format for cases where numChannels > 1.
Definition: AudioFormat.h:84
alexaClientSDK::avsCommon::utils::AudioFormat::Layout::NON_INTERLEAVED
@ NON_INTERLEAVED
Non-Interleaved : The L and R are separated in different streams.
alexaClientSDK::avsCommon::utils::AudioFormat::sampleRateHz
unsigned int sampleRateHz
The number of samples recorded or played per second.
Definition: AudioFormat.h:72
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::avsCommon::utils::operator<<
std::ostream & operator<<(std::ostream &stream, const AudioFormat::Encoding &encoding)
Definition: AudioFormat.h:94
alexaClientSDK::avsCommon::utils::AudioFormat::dataSigned
bool dataSigned
true if the data is signed false otherwise.
Definition: AudioFormat.h:81
alexaClientSDK::avsCommon::utils::AudioFormat::encoding
Encoding encoding
The encoding of the data.
Definition: AudioFormat.h:66
alexaClientSDK::avsCommon::utils::AudioFormat::numChannels
unsigned int numChannels
The number of channels.
Definition: AudioFormat.h:78
alexaClientSDK::avsCommon::utils::AudioFormat::endianness
Endianness endianness
The endianness of the data.
Definition: AudioFormat.h:69
alexaClientSDK::avsCommon::utils::AudioFormat::Endianness::BIG
@ BIG
Represents big endianness.
alexaClientSDK::avsCommon::utils::AudioFormat::Encoding::LPCM
@ LPCM
Represents LPCM (Linear pulse code modulation) encoding.
alexaClientSDK::avsCommon::utils::AudioFormat::Layout
Layout
Definition: AudioFormat.h:46

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