| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 EqualPowerPanner::EqualPowerPanner(float sampleRate) | 35 EqualPowerPanner::EqualPowerPanner(float sampleRate) |
| 36 : Panner(PanningModelEqualPower) {} | 36 : Panner(PanningModelEqualPower) {} |
| 37 | 37 |
| 38 void EqualPowerPanner::pan(double azimuth, | 38 void EqualPowerPanner::pan(double azimuth, |
| 39 double /*elevation*/, | 39 double /*elevation*/, |
| 40 const AudioBus* inputBus, | 40 const AudioBus* inputBus, |
| 41 AudioBus* outputBus, | 41 AudioBus* outputBus, |
| 42 size_t framesToProcess, | 42 size_t framesToProcess, |
| 43 AudioBus::ChannelInterpretation) { | 43 AudioBus::ChannelInterpretation) { |
| 44 bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || | 44 bool isInputSafe = inputBus && |
| 45 inputBus->numberOfChannels() == 2) && | 45 (inputBus->numberOfChannels() == 1 || |
| 46 inputBus->numberOfChannels() == 2) && |
| 46 framesToProcess <= inputBus->length(); | 47 framesToProcess <= inputBus->length(); |
| 47 ASSERT(isInputSafe); | 48 ASSERT(isInputSafe); |
| 48 if (!isInputSafe) | 49 if (!isInputSafe) |
| 49 return; | 50 return; |
| 50 | 51 |
| 51 unsigned numberOfInputChannels = inputBus->numberOfChannels(); | 52 unsigned numberOfInputChannels = inputBus->numberOfChannels(); |
| 52 | 53 |
| 53 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && | 54 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && |
| 54 framesToProcess <= outputBus->length(); | 55 framesToProcess <= outputBus->length(); |
| 55 ASSERT(isOutputSafe); | 56 ASSERT(isOutputSafe); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 desiredGainR = std::sin(piOverTwoDouble * desiredPanPosition); | 171 desiredGainR = std::sin(piOverTwoDouble * desiredPanPosition); |
| 171 } | 172 } |
| 172 | 173 |
| 173 void EqualPowerPanner::panWithSampleAccurateValues( | 174 void EqualPowerPanner::panWithSampleAccurateValues( |
| 174 double* azimuth, | 175 double* azimuth, |
| 175 double* /*elevation*/, | 176 double* /*elevation*/, |
| 176 const AudioBus* inputBus, | 177 const AudioBus* inputBus, |
| 177 AudioBus* outputBus, | 178 AudioBus* outputBus, |
| 178 size_t framesToProcess, | 179 size_t framesToProcess, |
| 179 AudioBus::ChannelInterpretation) { | 180 AudioBus::ChannelInterpretation) { |
| 180 bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || | 181 bool isInputSafe = inputBus && |
| 181 inputBus->numberOfChannels() == 2) && | 182 (inputBus->numberOfChannels() == 1 || |
| 183 inputBus->numberOfChannels() == 2) && |
| 182 framesToProcess <= inputBus->length(); | 184 framesToProcess <= inputBus->length(); |
| 183 DCHECK(isInputSafe); | 185 DCHECK(isInputSafe); |
| 184 if (!isInputSafe) | 186 if (!isInputSafe) |
| 185 return; | 187 return; |
| 186 | 188 |
| 187 unsigned numberOfInputChannels = inputBus->numberOfChannels(); | 189 unsigned numberOfInputChannels = inputBus->numberOfChannels(); |
| 188 | 190 |
| 189 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && | 191 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && |
| 190 framesToProcess <= outputBus->length(); | 192 framesToProcess <= outputBus->length(); |
| 191 DCHECK(isOutputSafe); | 193 DCHECK(isOutputSafe); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 float inputL = *sourceL++; | 234 float inputL = *sourceL++; |
| 233 float inputR = *sourceR++; | 235 float inputR = *sourceR++; |
| 234 *destinationL++ = static_cast<float>(inputL * desiredGainL); | 236 *destinationL++ = static_cast<float>(inputL * desiredGainL); |
| 235 *destinationR++ = static_cast<float>(inputR + inputL * desiredGainR); | 237 *destinationR++ = static_cast<float>(inputR + inputL * desiredGainR); |
| 236 } | 238 } |
| 237 } | 239 } |
| 238 } | 240 } |
| 239 } | 241 } |
| 240 | 242 |
| 241 } // namespace blink | 243 } // namespace blink |
| OLD | NEW |