| 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 18 matching lines...) Expand all Loading... |
| 29 #include <algorithm> | 29 #include <algorithm> |
| 30 #include <memory> | 30 #include <memory> |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 inline AudioNodeInput::AudioNodeInput(AudioHandler& handler) | 34 inline AudioNodeInput::AudioNodeInput(AudioHandler& handler) |
| 35 : AudioSummingJunction(handler.context()->deferredTaskHandler()), | 35 : AudioSummingJunction(handler.context()->deferredTaskHandler()), |
| 36 m_handler(handler) { | 36 m_handler(handler) { |
| 37 // Set to mono by default. | 37 // Set to mono by default. |
| 38 m_internalSummingBus = | 38 m_internalSummingBus = |
| 39 AudioBus::create(1, AudioHandler::ProcessingSizeInFrames); | 39 AudioBus::create(1, AudioUtilities::kRenderQuantumFrames); |
| 40 } | 40 } |
| 41 | 41 |
| 42 std::unique_ptr<AudioNodeInput> AudioNodeInput::create(AudioHandler& handler) { | 42 std::unique_ptr<AudioNodeInput> AudioNodeInput::create(AudioHandler& handler) { |
| 43 return wrapUnique(new AudioNodeInput(handler)); | 43 return wrapUnique(new AudioNodeInput(handler)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void AudioNodeInput::connect(AudioNodeOutput& output) { | 46 void AudioNodeInput::connect(AudioNodeOutput& output) { |
| 47 ASSERT(deferredTaskHandler().isGraphOwner()); | 47 ASSERT(deferredTaskHandler().isGraphOwner()); |
| 48 | 48 |
| 49 // Check if we're already connected to this output. | 49 // Check if we're already connected to this output. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void AudioNodeInput::updateInternalBus() { | 114 void AudioNodeInput::updateInternalBus() { |
| 115 DCHECK(deferredTaskHandler().isAudioThread()); | 115 DCHECK(deferredTaskHandler().isAudioThread()); |
| 116 ASSERT(deferredTaskHandler().isGraphOwner()); | 116 ASSERT(deferredTaskHandler().isGraphOwner()); |
| 117 | 117 |
| 118 unsigned numberOfInputChannels = numberOfChannels(); | 118 unsigned numberOfInputChannels = numberOfChannels(); |
| 119 | 119 |
| 120 if (numberOfInputChannels == m_internalSummingBus->numberOfChannels()) | 120 if (numberOfInputChannels == m_internalSummingBus->numberOfChannels()) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 m_internalSummingBus = AudioBus::create(numberOfInputChannels, | 123 m_internalSummingBus = AudioBus::create(numberOfInputChannels, |
| 124 AudioHandler::ProcessingSizeInFrames); | 124 AudioUtilities::kRenderQuantumFrames); |
| 125 } | 125 } |
| 126 | 126 |
| 127 unsigned AudioNodeInput::numberOfChannels() const { | 127 unsigned AudioNodeInput::numberOfChannels() const { |
| 128 AudioHandler::ChannelCountMode mode = handler().internalChannelCountMode(); | 128 AudioHandler::ChannelCountMode mode = handler().internalChannelCountMode(); |
| 129 if (mode == AudioHandler::Explicit) | 129 if (mode == AudioHandler::Explicit) |
| 130 return handler().channelCount(); | 130 return handler().channelCount(); |
| 131 | 131 |
| 132 // Find the number of channels of the connection with the largest number of | 132 // Find the number of channels of the connection with the largest number of |
| 133 // channels. | 133 // channels. |
| 134 unsigned maxChannels = 1; // one channel is the minimum allowed | 134 unsigned maxChannels = 1; // one channel is the minimum allowed |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 return internalSummingBus; | 216 return internalSummingBus; |
| 217 } | 217 } |
| 218 | 218 |
| 219 // Handle multiple connections case. | 219 // Handle multiple connections case. |
| 220 sumAllConnections(internalSummingBus, framesToProcess); | 220 sumAllConnections(internalSummingBus, framesToProcess); |
| 221 | 221 |
| 222 return internalSummingBus; | 222 return internalSummingBus; |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |