|
| 1 | +/* |
| 2 | + |
| 3 | + Copyright (c) 2017, Optical Tone Ltd. |
| 4 | + All rights reserved. |
| 5 | + |
| 6 | + Redistribution and use in source and binary forms, with or without |
| 7 | + modification, are permitted provided that the following conditions are met: |
| 8 | + |
| 9 | + 1. Redistributions of source code must retain the above copyright notice, this |
| 10 | + list of conditions and the following disclaimer. |
| 11 | + 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 | + this list of conditions and the following disclaimer in the documentation |
| 13 | + and/or other materials provided with the distribution. |
| 14 | + |
| 15 | + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 16 | + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 17 | + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 18 | + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 19 | + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 20 | + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 21 | + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 22 | + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 24 | + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | + |
| 26 | + The views and conclusions contained in the software and documentation are those |
| 27 | + of the authors and should not be interpreted as representing official policies, |
| 28 | + either expressed or implied, of the FreeBSD Project. |
| 29 | + |
| 30 | + */ |
| 31 | + |
| 32 | + |
| 33 | +namespace org |
| 34 | +{ |
| 35 | + namespace webRtc |
| 36 | + { |
| 37 | + [special, disposable] |
| 38 | + interface AudioData |
| 39 | + { |
| 40 | + /// <summary> |
| 41 | + /// Constructs a new audio data object. |
| 42 | + /// <summary> |
| 43 | + [constructor, default] |
| 44 | + void AudioData(); |
| 45 | + |
| 46 | + /// <summary> |
| 47 | + /// Gets if the data is read-only. |
| 48 | + /// <summary> |
| 49 | + [getter] |
| 50 | + bool readOnly; |
| 51 | + |
| 52 | + /// <summary> |
| 53 | + /// Gets or sets the audio samples data. |
| 54 | + /// <summary> |
| 55 | + [getter, setter] |
| 56 | + std::list<int16> data; |
| 57 | + }; |
| 58 | + |
| 59 | + [dictionary] |
| 60 | + struct AudioBufferConfiguration |
| 61 | + { |
| 62 | + /// <summary> |
| 63 | + /// Gets or sets the total number of input channels. |
| 64 | + /// <summary> |
| 65 | + size_t inputChannels; |
| 66 | + |
| 67 | + /// <summary> |
| 68 | + /// Gets or sets the samples per input channel. |
| 69 | + /// <summary> |
| 70 | + size_t inputSamplesPerChannel; |
| 71 | + |
| 72 | + /// <summary> |
| 73 | + /// Gets or sets the total number of process channels. |
| 74 | + /// <summary> |
| 75 | + size_t processChannels; |
| 76 | + |
| 77 | + /// <summary> |
| 78 | + /// Gets or sets the samples per process channel. |
| 79 | + /// <summary> |
| 80 | + size_t procesSamplesPerChannel; |
| 81 | + |
| 82 | + /// <summary> |
| 83 | + /// Gets or sets the total number of output channels. |
| 84 | + /// <summary> |
| 85 | + size_t outputChannels; |
| 86 | + }; |
| 87 | + |
| 88 | + [dictionary] |
| 89 | + struct AudioFrame |
| 90 | + { |
| 91 | + /// <summary> |
| 92 | + /// Contructs an audio frame. |
| 93 | + /// <summary> |
| 94 | + [constructor, default] |
| 95 | + void AudioFrame(); |
| 96 | + |
| 97 | + /// <summary> |
| 98 | + /// Gets or sets the audio frame data. |
| 99 | + /// <summary> |
| 100 | + AudioData data; |
| 101 | + |
| 102 | + /// <summary> |
| 103 | + /// Gets or sets the voice activity flag. |
| 104 | + /// </summary> |
| 105 | + VadActivity activity; |
| 106 | + |
| 107 | + /// <summary> |
| 108 | + /// Gets or sets the samples per input channel. |
| 109 | + /// <summary> |
| 110 | + size_t channels; |
| 111 | + |
| 112 | + /// <summary> |
| 113 | + /// Gets or sets the samples per channel. |
| 114 | + /// <summary> |
| 115 | + size_t samplesPerChannel; |
| 116 | + }; |
| 117 | + |
| 118 | + [disposable] |
| 119 | + interface AudioBuffer |
| 120 | + { |
| 121 | + /// <summary> |
| 122 | + /// Constructs a new audio buffer from a configuration. |
| 123 | + /// </summary> |
| 124 | + [constructor, default] |
| 125 | + void AudioBuffer(AudioBufferConfiguration config); |
| 126 | + |
| 127 | + /// <summary> |
| 128 | + /// Gets the total number of channels. |
| 129 | + /// <summary> |
| 130 | + [getter] |
| 131 | + size_t channels; |
| 132 | + |
| 133 | + /// <summary> |
| 134 | + /// Gets the samples per channel. |
| 135 | + /// <summary> |
| 136 | + [getter] |
| 137 | + size_t samplesPerChannel; |
| 138 | + |
| 139 | + /// <summary> |
| 140 | + /// Gets the total number of bands. |
| 141 | + /// <summary> |
| 142 | + [getter] |
| 143 | + size_t bands; |
| 144 | + |
| 145 | + /// <summary> |
| 146 | + /// Gets the total number of frames per band. |
| 147 | + /// <summary> |
| 148 | + [getter] |
| 149 | + size_t framesPerBand; |
| 150 | + |
| 151 | + /// <summary> |
| 152 | + /// Gets the audio samples for a given channel. |
| 153 | + /// <summary> |
| 154 | + AudioData channel(size_t channel); |
| 155 | + |
| 156 | + /// <summary> |
| 157 | + /// Gets the audio samples for data split by bands. |
| 158 | + /// <summary> |
| 159 | + AudioData splitBand( |
| 160 | + size_t channel, |
| 161 | + Band band); |
| 162 | + |
| 163 | + /// <summary> |
| 164 | + /// Gets the audio samples for data split by channels. |
| 165 | + /// <summary> |
| 166 | + AudioData splitChannel( |
| 167 | + Band band, |
| 168 | + size_t channel); |
| 169 | + |
| 170 | + /// <summary> |
| 171 | + /// Gets a read-only view of the mixed low pass data. |
| 172 | + /// </summary> |
| 173 | + [getter] |
| 174 | + AudioData mixedLowPassData; |
| 175 | + |
| 176 | + /// <summary> |
| 177 | + /// Gets a read-only reference view of the low pass data |
| 178 | + /// for a given channel. |
| 179 | + /// </summary> |
| 180 | + AudioData lowPassReference(size_t channel); |
| 181 | + |
| 182 | + /// <summary> |
| 183 | + /// Gets or sets the voice activity flag. |
| 184 | + /// </summary> |
| 185 | + [getter, setter] |
| 186 | + VadActivity activity; |
| 187 | + |
| 188 | + /// <summary> |
| 189 | + /// Deinterleaves samples from an audio frame. |
| 190 | + /// </summary> |
| 191 | + void deinterleaveFrom(AudioFrame frame); |
| 192 | + /// <summary> |
| 193 | + /// Interleaves samples from an audio frame. |
| 194 | + /// </summary> |
| 195 | + void interleaveTo(AudioFrame frame); |
| 196 | + |
| 197 | + /// <summary> |
| 198 | + /// Copies the low pass data to the low pass reference. |
| 199 | + /// <summary> |
| 200 | + void copyLowPassToReference(); |
| 201 | + |
| 202 | + /// <summary> |
| 203 | + /// Splits the signal into different bands. |
| 204 | + /// </summary> |
| 205 | + void splitIntoFrequencyBands(); |
| 206 | + /// <summary> |
| 207 | + /// Recombine the different bands into one signal. |
| 208 | + /// </summary> |
| 209 | + void mergeFrequencyBands(); |
| 210 | + }; |
| 211 | + |
| 212 | + |
| 213 | + } |
| 214 | +} |
0 commit comments