| 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 bool isAzimuthGood = azimuth >= -180.0 && azimuth <= 180.0; | 153 bool isAzimuthGood = azimuth >= -180.0 && azimuth <= 180.0; |
| 154 ASSERT(isAzimuthGood); | 154 ASSERT(isAzimuthGood); |
| 155 if (!isAzimuthGood) { | 155 if (!isAzimuthGood) { |
| 156 outputBus->zero(); | 156 outputBus->zero(); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Normally, we'll just be dealing with mono sources. | 160 // Normally, we'll just be dealing with mono sources. |
| 161 // If we have a stereo input, implement stereo panning with left source proc
essed by left HRTF, and right source by right HRTF. | 161 // If we have a stereo input, implement stereo panning with left source proc
essed by left HRTF, and right source by right HRTF. |
| 162 const AudioChannel* inputChannelL = inputBus->channelByType(AudioBus::Channe
lLeft); | 162 const AudioChannel* inputChannelL = inputBus->channelByType(AudioBus::Channe
lLeft); |
| 163 const AudioChannel* inputChannelR = numInputChannels > 1 ? inputBus->channel
ByType(AudioBus::ChannelRight) : 0; | 163 const AudioChannel* inputChannelR = numInputChannels > 1 ? inputBus->channel
ByType(AudioBus::ChannelRight) : nullptr; |
| 164 | 164 |
| 165 // Get source and destination pointers. | 165 // Get source and destination pointers. |
| 166 const float* sourceL = inputChannelL->data(); | 166 const float* sourceL = inputChannelL->data(); |
| 167 const float* sourceR = numInputChannels > 1 ? inputChannelR->data() : source
L; | 167 const float* sourceR = numInputChannels > 1 ? inputChannelR->data() : source
L; |
| 168 float* destinationL = outputBus->channelByType(AudioBus::ChannelLeft)->mutab
leData(); | 168 float* destinationL = outputBus->channelByType(AudioBus::ChannelLeft)->mutab
leData(); |
| 169 float* destinationR = outputBus->channelByType(AudioBus::ChannelRight)->muta
bleData(); | 169 float* destinationR = outputBus->channelByType(AudioBus::ChannelRight)->muta
bleData(); |
| 170 | 170 |
| 171 double azimuthBlend; | 171 double azimuthBlend; |
| 172 int desiredAzimuthIndex = calculateDesiredAzimuthIndexAndBlend(azimuth, azim
uthBlend); | 172 int desiredAzimuthIndex = calculateDesiredAzimuthIndexAndBlend(azimuth, azim
uthBlend); |
| 173 | 173 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 DEFINE_TRACE(HRTFPanner) | 317 DEFINE_TRACE(HRTFPanner) |
| 318 { | 318 { |
| 319 visitor->trace(m_databaseLoader); | 319 visitor->trace(m_databaseLoader); |
| 320 Panner::trace(visitor); | 320 Panner::trace(visitor); |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace blink | 323 } // namespace blink |
| 324 | 324 |
| 325 #endif // ENABLE(WEB_AUDIO) | 325 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |