| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 29 matching lines...) Expand all Loading... |
| 40 private: | 40 private: |
| 41 FILE* file_handle_; | 41 FILE* file_handle_; |
| 42 | 42 |
| 43 RTC_DISALLOW_COPY_AND_ASSIGN(RawFile); | 43 RTC_DISALLOW_COPY_AND_ASSIGN(RawFile); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Reads ChannelBuffers from a provided WavReader. | 46 // Reads ChannelBuffers from a provided WavReader. |
| 47 class ChannelBufferWavReader final { | 47 class ChannelBufferWavReader final { |
| 48 public: | 48 public: |
| 49 explicit ChannelBufferWavReader(std::unique_ptr<WavReader> file); | 49 explicit ChannelBufferWavReader(std::unique_ptr<WavReader> file); |
| 50 ~ChannelBufferWavReader(); |
| 50 | 51 |
| 51 // Reads data from the file according to the |buffer| format. Returns false if | 52 // Reads data from the file according to the |buffer| format. Returns false if |
| 52 // a full buffer can't be read from the file. | 53 // a full buffer can't be read from the file. |
| 53 bool Read(ChannelBuffer<float>* buffer); | 54 bool Read(ChannelBuffer<float>* buffer); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 std::unique_ptr<WavReader> file_; | 57 std::unique_ptr<WavReader> file_; |
| 57 std::vector<float> interleaved_; | 58 std::vector<float> interleaved_; |
| 58 | 59 |
| 59 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelBufferWavReader); | 60 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelBufferWavReader); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 // Writes ChannelBuffers to a provided WavWriter. | 63 // Writes ChannelBuffers to a provided WavWriter. |
| 63 class ChannelBufferWavWriter final { | 64 class ChannelBufferWavWriter final { |
| 64 public: | 65 public: |
| 65 explicit ChannelBufferWavWriter(std::unique_ptr<WavWriter> file); | 66 explicit ChannelBufferWavWriter(std::unique_ptr<WavWriter> file); |
| 67 ~ChannelBufferWavWriter(); |
| 68 |
| 66 void Write(const ChannelBuffer<float>& buffer); | 69 void Write(const ChannelBuffer<float>& buffer); |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 std::unique_ptr<WavWriter> file_; | 72 std::unique_ptr<WavWriter> file_; |
| 70 std::vector<float> interleaved_; | 73 std::vector<float> interleaved_; |
| 71 | 74 |
| 72 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelBufferWavWriter); | 75 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelBufferWavWriter); |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 void WriteIntData(const int16_t* data, | 78 void WriteIntData(const int16_t* data, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // appropriate error message has been printed to stdout. | 149 // appropriate error message has been printed to stdout. |
| 147 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions, | 150 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions, |
| 148 size_t num_mics); | 151 size_t num_mics); |
| 149 | 152 |
| 150 // Same as above, but without the num_mics check for when it isn't available. | 153 // Same as above, but without the num_mics check for when it isn't available. |
| 151 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions); | 154 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions); |
| 152 | 155 |
| 153 } // namespace webrtc | 156 } // namespace webrtc |
| 154 | 157 |
| 155 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_TEST_UTILS_H_ | 158 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_TEST_UTILS_H_ |
| OLD | NEW |