OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 new HRTFElevation(std::move(kernelListL), std::move(kernelListR), | 302 new HRTFElevation(std::move(kernelListL), std::move(kernelListR), |
303 elevation, sampleRate)); | 303 elevation, sampleRate)); |
304 return hrtfElevation; | 304 return hrtfElevation; |
305 } | 305 } |
306 | 306 |
307 std::unique_ptr<HRTFElevation> HRTFElevation::createByInterpolatingSlices( | 307 std::unique_ptr<HRTFElevation> HRTFElevation::createByInterpolatingSlices( |
308 HRTFElevation* hrtfElevation1, | 308 HRTFElevation* hrtfElevation1, |
309 HRTFElevation* hrtfElevation2, | 309 HRTFElevation* hrtfElevation2, |
310 float x, | 310 float x, |
311 float sampleRate) { | 311 float sampleRate) { |
312 ASSERT(hrtfElevation1 && hrtfElevation2); | 312 DCHECK(hrtfElevation1); |
| 313 DCHECK(hrtfElevation2); |
313 if (!hrtfElevation1 || !hrtfElevation2) | 314 if (!hrtfElevation1 || !hrtfElevation2) |
314 return nullptr; | 315 return nullptr; |
315 | 316 |
316 ASSERT(x >= 0.0 && x < 1.0); | 317 DCHECK_GE(x, 0.0); |
| 318 DCHECK_LT(x, 1.0); |
317 | 319 |
318 std::unique_ptr<HRTFKernelList> kernelListL = | 320 std::unique_ptr<HRTFKernelList> kernelListL = |
319 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); | 321 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); |
320 std::unique_ptr<HRTFKernelList> kernelListR = | 322 std::unique_ptr<HRTFKernelList> kernelListR = |
321 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); | 323 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); |
322 | 324 |
323 HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); | 325 HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); |
324 HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); | 326 HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); |
325 HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL(); | 327 HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL(); |
326 HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR(); | 328 HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); | 378 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); |
377 | 379 |
378 // Linearly interpolate delays. | 380 // Linearly interpolate delays. |
379 frameDelayL = | 381 frameDelayL = |
380 (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L; | 382 (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L; |
381 frameDelayR = | 383 frameDelayR = |
382 (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R; | 384 (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R; |
383 } | 385 } |
384 | 386 |
385 } // namespace blink | 387 } // namespace blink |
OLD | NEW |