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 |
11 // MSVC++ requires this to be set before any other includes to get M_PI. | 11 // MSVC++ requires this to be set before any other includes to get M_PI. |
12 #define _USE_MATH_DEFINES | 12 #define _USE_MATH_DEFINES |
13 | 13 |
14 #include <cmath> | 14 #include <cmath> |
15 #include <limits> | 15 #include <limits> |
16 | 16 |
| 17 #include "webrtc/common_audio/wav_file.h" |
| 18 #include "webrtc/common_audio/wav_header.h" |
17 #include "webrtc/test/gtest.h" | 19 #include "webrtc/test/gtest.h" |
18 #include "webrtc/common_audio/wav_header.h" | |
19 #include "webrtc/common_audio/wav_file.h" | |
20 #include "webrtc/test/testsupport/fileutils.h" | 20 #include "webrtc/test/testsupport/fileutils.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 | 23 |
24 static const float kSamples[] = {0.0, 10.0, 4e4, -1e9}; | 24 static const float kSamples[] = {0.0, 10.0, 4e4, -1e9}; |
25 | 25 |
26 // Write a tiny WAV file with the C++ interface and verify the result. | 26 // Write a tiny WAV file with the C++ interface and verify the result. |
27 TEST(WavWriterTest, CPP) { | 27 TEST(WavWriterTest, CPP) { |
28 const std::string outfile = test::OutputPath() + "wavtest1.wav"; | 28 const std::string outfile = test::OutputPath() + "wavtest1.wav"; |
29 static const size_t kNumSamples = 3; | 29 static const size_t kNumSamples = 3; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 float read_samples[kNumSamples]; | 168 float read_samples[kNumSamples]; |
169 EXPECT_EQ(kNumSamples, r.ReadSamples(kNumSamples, read_samples)); | 169 EXPECT_EQ(kNumSamples, r.ReadSamples(kNumSamples, read_samples)); |
170 for (size_t i = 0; i < kNumSamples; ++i) | 170 for (size_t i = 0; i < kNumSamples; ++i) |
171 EXPECT_NEAR(samples[i], read_samples[i], 1); | 171 EXPECT_NEAR(samples[i], read_samples[i], 1); |
172 | 172 |
173 EXPECT_EQ(0u, r.ReadSamples(kNumSamples, read_samples)); | 173 EXPECT_EQ(0u, r.ReadSamples(kNumSamples, read_samples)); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 } // namespace webrtc | 177 } // namespace webrtc |
OLD | NEW |