| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 PassRefPtr<ChannelSplitterHandler> ChannelSplitterHandler::create(AudioNode& nod
e, float sampleRate, unsigned numberOfOutputs) | 47 PassRefPtr<ChannelSplitterHandler> ChannelSplitterHandler::create(AudioNode& nod
e, float sampleRate, unsigned numberOfOutputs) |
| 48 { | 48 { |
| 49 return adoptRef(new ChannelSplitterHandler(node, sampleRate, numberOfOutputs
)); | 49 return adoptRef(new ChannelSplitterHandler(node, sampleRate, numberOfOutputs
)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ChannelSplitterHandler::process(size_t framesToProcess) | 52 void ChannelSplitterHandler::process(size_t framesToProcess) |
| 53 { | 53 { |
| 54 AudioBus* source = input(0).bus(); | 54 AudioBus* source = input(0).bus(); |
| 55 ASSERT(source); | 55 DCHECK(source); |
| 56 ASSERT_UNUSED(framesToProcess, framesToProcess == source->length()); | 56 ASSERT_UNUSED(framesToProcess, framesToProcess == source->length()); |
| 57 | 57 |
| 58 unsigned numberOfSourceChannels = source->numberOfChannels(); | 58 unsigned numberOfSourceChannels = source->numberOfChannels(); |
| 59 | 59 |
| 60 for (unsigned i = 0; i < numberOfOutputs(); ++i) { | 60 for (unsigned i = 0; i < numberOfOutputs(); ++i) { |
| 61 AudioBus* destination = output(i).bus(); | 61 AudioBus* destination = output(i).bus(); |
| 62 ASSERT(destination); | 62 DCHECK(destination); |
| 63 | 63 |
| 64 if (i < numberOfSourceChannels) { | 64 if (i < numberOfSourceChannels) { |
| 65 // Split the channel out if it exists in the source. | 65 // Split the channel out if it exists in the source. |
| 66 // It would be nice to avoid the copy and simply pass along pointers
, but this becomes extremely difficult with fanout and fanin. | 66 // It would be nice to avoid the copy and simply pass along pointers
, but this becomes extremely difficult with fanout and fanin. |
| 67 destination->channel(0)->copyFrom(source->channel(i)); | 67 destination->channel(0)->copyFrom(source->channel(i)); |
| 68 } else if (output(i).renderingFanOutCount() > 0) { | 68 } else if (output(i).renderingFanOutCount() > 0) { |
| 69 // Only bother zeroing out the destination if it's connected to anyt
hing | 69 // Only bother zeroing out the destination if it's connected to anyt
hing |
| 70 destination->zero(); | 70 destination->zero(); |
| 71 } | 71 } |
| 72 } | 72 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 BaseAudioContext::maxNumberOfChannels(), | 108 BaseAudioContext::maxNumberOfChannels(), |
| 109 ExceptionMessages::InclusiveBound)); | 109 ExceptionMessages::InclusiveBound)); |
| 110 return nullptr; | 110 return nullptr; |
| 111 } | 111 } |
| 112 | 112 |
| 113 return new ChannelSplitterNode(context, numberOfOutputs); | 113 return new ChannelSplitterNode(context, numberOfOutputs); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace blink | 116 } // namespace blink |
| 117 | 117 |
| OLD | NEW |