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 DCHECK(hrtfElevation1); | 312 ASSERT(hrtfElevation1 && hrtfElevation2); |
313 DCHECK(hrtfElevation2); | |
314 if (!hrtfElevation1 || !hrtfElevation2) | 313 if (!hrtfElevation1 || !hrtfElevation2) |
315 return nullptr; | 314 return nullptr; |
316 | 315 |
317 DCHECK_GE(x, 0.0); | 316 ASSERT(x >= 0.0 && x < 1.0); |
318 DCHECK_LT(x, 1.0); | |
319 | 317 |
320 std::unique_ptr<HRTFKernelList> kernelListL = | 318 std::unique_ptr<HRTFKernelList> kernelListL = |
321 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); | 319 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); |
322 std::unique_ptr<HRTFKernelList> kernelListR = | 320 std::unique_ptr<HRTFKernelList> kernelListR = |
323 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); | 321 WTF::makeUnique<HRTFKernelList>(NumberOfTotalAzimuths); |
324 | 322 |
325 HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); | 323 HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); |
326 HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); | 324 HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); |
327 HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL(); | 325 HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL(); |
328 HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR(); | 326 HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); | 376 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); |
379 | 377 |
380 // Linearly interpolate delays. | 378 // Linearly interpolate delays. |
381 frameDelayL = | 379 frameDelayL = |
382 (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L; | 380 (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L; |
383 frameDelayR = | 381 frameDelayR = |
384 (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R; | 382 (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R; |
385 } | 383 } |
386 | 384 |
387 } // namespace blink | 385 } // namespace blink |
OLD | NEW |