| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 26 matching lines...) Expand all Loading... |
| 37 RawFile* raw_file) { | 37 RawFile* raw_file) { |
| 38 if (wav_file) { | 38 if (wav_file) { |
| 39 wav_file->WriteSamples(data, length); | 39 wav_file->WriteSamples(data, length); |
| 40 } | 40 } |
| 41 if (raw_file) { | 41 if (raw_file) { |
| 42 raw_file->WriteSamples(data, length); | 42 raw_file->WriteSamples(data, length); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void WriteFloatData(const float* const* data, | 46 void WriteFloatData(const float* const* data, |
| 47 int samples_per_channel, | 47 size_t samples_per_channel, |
| 48 int num_channels, | 48 size_t num_channels, |
| 49 WavWriter* wav_file, | 49 WavWriter* wav_file, |
| 50 RawFile* raw_file) { | 50 RawFile* raw_file) { |
| 51 size_t length = num_channels * samples_per_channel; | 51 size_t length = num_channels * samples_per_channel; |
| 52 rtc::scoped_ptr<float[]> buffer(new float[length]); | 52 rtc::scoped_ptr<float[]> buffer(new float[length]); |
| 53 Interleave(data, samples_per_channel, num_channels, buffer.get()); | 53 Interleave(data, samples_per_channel, num_channels, buffer.get()); |
| 54 if (raw_file) { | 54 if (raw_file) { |
| 55 raw_file->WriteSamples(buffer.get(), length); | 55 raw_file->WriteSamples(buffer.get(), length); |
| 56 } | 56 } |
| 57 // TODO(aluebs): Use ScaleToInt16Range() from audio_util | 57 // TODO(aluebs): Use ScaleToInt16Range() from audio_util |
| 58 for (size_t i = 0; i < length; ++i) { | 58 for (size_t i = 0; i < length; ++i) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 78 return AudioProcessing::kChunkSizeMs * rate / 1000; | 78 return AudioProcessing::kChunkSizeMs * rate / 1000; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SetFrameSampleRate(AudioFrame* frame, | 81 void SetFrameSampleRate(AudioFrame* frame, |
| 82 int sample_rate_hz) { | 82 int sample_rate_hz) { |
| 83 frame->sample_rate_hz_ = sample_rate_hz; | 83 frame->sample_rate_hz_ = sample_rate_hz; |
| 84 frame->samples_per_channel_ = AudioProcessing::kChunkSizeMs * | 84 frame->samples_per_channel_ = AudioProcessing::kChunkSizeMs * |
| 85 sample_rate_hz / 1000; | 85 sample_rate_hz / 1000; |
| 86 } | 86 } |
| 87 | 87 |
| 88 AudioProcessing::ChannelLayout LayoutFromChannels(int num_channels) { | 88 AudioProcessing::ChannelLayout LayoutFromChannels(size_t num_channels) { |
| 89 switch (num_channels) { | 89 switch (num_channels) { |
| 90 case 1: | 90 case 1: |
| 91 return AudioProcessing::kMono; | 91 return AudioProcessing::kMono; |
| 92 case 2: | 92 case 2: |
| 93 return AudioProcessing::kStereo; | 93 return AudioProcessing::kStereo; |
| 94 default: | 94 default: |
| 95 assert(false); | 95 assert(false); |
| 96 return AudioProcessing::kMono; | 96 return AudioProcessing::kMono; |
| 97 } | 97 } |
| 98 } | 98 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 110 double y = values[i + 1]; | 110 double y = values[i + 1]; |
| 111 double z = values[i + 2]; | 111 double z = values[i + 2]; |
| 112 result.push_back(Point(x, y, z)); | 112 result.push_back(Point(x, y, z)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 return result; | 115 return result; |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 } // namespace webrtc | 119 } // namespace webrtc |
| OLD | NEW |