OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 123 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); |
124 return 0; | 124 return 0; |
125 } | 125 } |
126 | 126 |
127 // ---------------------------------------------------------------------------- | 127 // ---------------------------------------------------------------------------- |
128 // SetRecordingSampleRate | 128 // SetRecordingSampleRate |
129 // ---------------------------------------------------------------------------- | 129 // ---------------------------------------------------------------------------- |
130 | 130 |
131 int32_t AudioDeviceBuffer::SetRecordingSampleRate(uint32_t fsHz) | 131 int32_t AudioDeviceBuffer::SetRecordingSampleRate(uint32_t fsHz) |
132 { | 132 { |
133 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "AudioDeviceBuffer::SetRe
cordingSampleRate(fsHz=%u)", fsHz); | |
134 | |
135 CriticalSectionScoped lock(&_critSect); | 133 CriticalSectionScoped lock(&_critSect); |
136 _recSampleRate = fsHz; | 134 _recSampleRate = fsHz; |
137 return 0; | 135 return 0; |
138 } | 136 } |
139 | 137 |
140 // ---------------------------------------------------------------------------- | 138 // ---------------------------------------------------------------------------- |
141 // SetPlayoutSampleRate | 139 // SetPlayoutSampleRate |
142 // ---------------------------------------------------------------------------- | 140 // ---------------------------------------------------------------------------- |
143 | 141 |
144 int32_t AudioDeviceBuffer::SetPlayoutSampleRate(uint32_t fsHz) | 142 int32_t AudioDeviceBuffer::SetPlayoutSampleRate(uint32_t fsHz) |
145 { | 143 { |
146 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "AudioDeviceBuffer::SetPl
ayoutSampleRate(fsHz=%u)", fsHz); | |
147 | |
148 CriticalSectionScoped lock(&_critSect); | 144 CriticalSectionScoped lock(&_critSect); |
149 _playSampleRate = fsHz; | 145 _playSampleRate = fsHz; |
150 return 0; | 146 return 0; |
151 } | 147 } |
152 | 148 |
153 // ---------------------------------------------------------------------------- | 149 // ---------------------------------------------------------------------------- |
154 // RecordingSampleRate | 150 // RecordingSampleRate |
155 // ---------------------------------------------------------------------------- | 151 // ---------------------------------------------------------------------------- |
156 | 152 |
157 int32_t AudioDeviceBuffer::RecordingSampleRate() const | 153 int32_t AudioDeviceBuffer::RecordingSampleRate() const |
158 { | 154 { |
159 return _recSampleRate; | 155 return _recSampleRate; |
160 } | 156 } |
161 | 157 |
162 // ---------------------------------------------------------------------------- | 158 // ---------------------------------------------------------------------------- |
163 // PlayoutSampleRate | 159 // PlayoutSampleRate |
164 // ---------------------------------------------------------------------------- | 160 // ---------------------------------------------------------------------------- |
165 | 161 |
166 int32_t AudioDeviceBuffer::PlayoutSampleRate() const | 162 int32_t AudioDeviceBuffer::PlayoutSampleRate() const |
167 { | 163 { |
168 return _playSampleRate; | 164 return _playSampleRate; |
169 } | 165 } |
170 | 166 |
171 // ---------------------------------------------------------------------------- | 167 // ---------------------------------------------------------------------------- |
172 // SetRecordingChannels | 168 // SetRecordingChannels |
173 // ---------------------------------------------------------------------------- | 169 // ---------------------------------------------------------------------------- |
174 | 170 |
175 int32_t AudioDeviceBuffer::SetRecordingChannels(uint8_t channels) | 171 int32_t AudioDeviceBuffer::SetRecordingChannels(uint8_t channels) |
176 { | 172 { |
177 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "AudioDeviceBuffer::SetRe
cordingChannels(channels=%u)", channels); | |
178 | |
179 CriticalSectionScoped lock(&_critSect); | 173 CriticalSectionScoped lock(&_critSect); |
180 _recChannels = channels; | 174 _recChannels = channels; |
181 _recBytesPerSample = 2*channels; // 16 bits per sample in mono, 32 bits in
stereo | 175 _recBytesPerSample = 2*channels; // 16 bits per sample in mono, 32 bits in
stereo |
182 return 0; | 176 return 0; |
183 } | 177 } |
184 | 178 |
185 // ---------------------------------------------------------------------------- | 179 // ---------------------------------------------------------------------------- |
186 // SetPlayoutChannels | 180 // SetPlayoutChannels |
187 // ---------------------------------------------------------------------------- | 181 // ---------------------------------------------------------------------------- |
188 | 182 |
189 int32_t AudioDeviceBuffer::SetPlayoutChannels(uint8_t channels) | 183 int32_t AudioDeviceBuffer::SetPlayoutChannels(uint8_t channels) |
190 { | 184 { |
191 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "AudioDeviceBuffer::SetPl
ayoutChannels(channels=%u)", channels); | |
192 | |
193 CriticalSectionScoped lock(&_critSect); | 185 CriticalSectionScoped lock(&_critSect); |
194 _playChannels = channels; | 186 _playChannels = channels; |
195 // 16 bits per sample in mono, 32 bits in stereo | 187 // 16 bits per sample in mono, 32 bits in stereo |
196 _playBytesPerSample = 2*channels; | 188 _playBytesPerSample = 2*channels; |
197 return 0; | 189 return 0; |
198 } | 190 } |
199 | 191 |
200 // ---------------------------------------------------------------------------- | 192 // ---------------------------------------------------------------------------- |
201 // SetRecordingChannel | 193 // SetRecordingChannel |
202 // | 194 // |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 if (_playFile.Open()) | 574 if (_playFile.Open()) |
583 { | 575 { |
584 // write to binary file in mono or stereo (interleaved) | 576 // write to binary file in mono or stereo (interleaved) |
585 _playFile.Write(&_playBuffer[0], _playSize); | 577 _playFile.Write(&_playBuffer[0], _playSize); |
586 } | 578 } |
587 | 579 |
588 return static_cast<int32_t>(_playSamples); | 580 return static_cast<int32_t>(_playSamples); |
589 } | 581 } |
590 | 582 |
591 } // namespace webrtc | 583 } // namespace webrtc |
OLD | NEW |