| 407 | } |
| 408 | |
| 409 | void HRTFElevation::getKernelsFromAzimuth(double azimuthBlend, unsigned azimuthIndex, HRTFKernel *& kernelL, HRTFKernel *& kernelR, double & frameDelayL, double & frameDelayR) |
| 410 | { |
| 411 | bool checkAzimuthBlend = azimuthBlend >= 0.0 && azimuthBlend < 1.0; |
| 412 | ASSERT(checkAzimuthBlend); |
| 413 | if (!checkAzimuthBlend) |
| 414 | { |
| 415 | azimuthBlend = 0.0; |
| 416 | } |
| 417 | |
| 418 | size_t numKernels = m_kernelListL->size(); |
| 419 | |
| 420 | bool isIndexGood = azimuthIndex < numKernels; |
| 421 | ASSERT(isIndexGood); |
| 422 | if (!isIndexGood) |
| 423 | { |
| 424 | kernelL = 0; |
| 425 | kernelR = 0; |
| 426 | return; |
| 427 | } |
| 428 | |
| 429 | // Return the left and right kernels. |
| 430 | kernelL = m_kernelListL->at(azimuthIndex).get(); |
| 431 | kernelR = m_kernelListR->at(azimuthIndex).get(); |
| 432 | |
| 433 | frameDelayL = m_kernelListL->at(azimuthIndex)->frameDelay(); |
| 434 | frameDelayR = m_kernelListR->at(azimuthIndex)->frameDelay(); |
| 435 | |
| 436 | int azimuthIndex2 = (azimuthIndex + 1) % numKernels; |
| 437 | double frameDelay2L = m_kernelListL->at(azimuthIndex2)->frameDelay(); |
| 438 | double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); |
| 439 | |
| 440 | // Linearly interpolate delays. |
| 441 | frameDelayL = (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L; |
| 442 | frameDelayR = (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R; |
| 443 | } |
| 444 | |
| 445 | |
| 446 |
no test coverage detected