| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 void EqualPowerPanner::pan(double azimuth, | 39 void EqualPowerPanner::pan(double azimuth, |
| 40 double /*elevation*/, | 40 double /*elevation*/, |
| 41 const AudioBus* inputBus, | 41 const AudioBus* inputBus, |
| 42 AudioBus* outputBus, | 42 AudioBus* outputBus, |
| 43 size_t framesToProcess, | 43 size_t framesToProcess, |
| 44 AudioBus::ChannelInterpretation) { | 44 AudioBus::ChannelInterpretation) { |
| 45 bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || | 45 bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || |
| 46 inputBus->numberOfChannels() == 2) && | 46 inputBus->numberOfChannels() == 2) && |
| 47 framesToProcess <= inputBus->length(); | 47 framesToProcess <= inputBus->length(); |
| 48 ASSERT(isInputSafe); | 48 DCHECK(isInputSafe); |
| 49 if (!isInputSafe) | 49 if (!isInputSafe) |
| 50 return; | 50 return; |
| 51 | 51 |
| 52 unsigned numberOfInputChannels = inputBus->numberOfChannels(); | 52 unsigned numberOfInputChannels = inputBus->numberOfChannels(); |
| 53 | 53 |
| 54 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && | 54 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && |
| 55 framesToProcess <= outputBus->length(); | 55 framesToProcess <= outputBus->length(); |
| 56 ASSERT(isOutputSafe); | 56 DCHECK(isOutputSafe); |
| 57 if (!isOutputSafe) | 57 if (!isOutputSafe) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 const float* sourceL = inputBus->channel(0)->data(); | 60 const float* sourceL = inputBus->channel(0)->data(); |
| 61 const float* sourceR = | 61 const float* sourceR = |
| 62 numberOfInputChannels > 1 ? inputBus->channel(1)->data() : sourceL; | 62 numberOfInputChannels > 1 ? inputBus->channel(1)->data() : sourceL; |
| 63 float* destinationL = | 63 float* destinationL = |
| 64 outputBus->channelByType(AudioBus::ChannelLeft)->mutableData(); | 64 outputBus->channelByType(AudioBus::ChannelLeft)->mutableData(); |
| 65 float* destinationR = | 65 float* destinationR = |
| 66 outputBus->channelByType(AudioBus::ChannelRight)->mutableData(); | 66 outputBus->channelByType(AudioBus::ChannelRight)->mutableData(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 float inputL = *sourceL++; | 233 float inputL = *sourceL++; |
| 234 float inputR = *sourceR++; | 234 float inputR = *sourceR++; |
| 235 *destinationL++ = static_cast<float>(inputL * desiredGainL); | 235 *destinationL++ = static_cast<float>(inputL * desiredGainL); |
| 236 *destinationR++ = static_cast<float>(inputR + inputL * desiredGainR); | 236 *destinationR++ = static_cast<float>(inputR + inputL * desiredGainR); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |