| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 // connected. But internally our outputs should be disabled from the inputs | 422 // connected. But internally our outputs should be disabled from the inputs |
| 423 // they're connected to. disable() can recursively deref connections (and | 423 // they're connected to. disable() can recursively deref connections (and |
| 424 // call disable()) down a whole chain of connected nodes. | 424 // call disable()) down a whole chain of connected nodes. |
| 425 | 425 |
| 426 // TODO(rtoy,hongchan): we need special cases the convolver, delay, biquad, | 426 // TODO(rtoy,hongchan): we need special cases the convolver, delay, biquad, |
| 427 // and IIR since they have a significant tail-time and shouldn't be | 427 // and IIR since they have a significant tail-time and shouldn't be |
| 428 // disconnected simply because they no longer have any input connections. | 428 // disconnected simply because they no longer have any input connections. |
| 429 // This needs to be handled more generally where AudioNodes have a tailTime | 429 // This needs to be handled more generally where AudioNodes have a tailTime |
| 430 // attribute. Then the AudioNode only needs to remain "active" for tailTime | 430 // attribute. Then the AudioNode only needs to remain "active" for tailTime |
| 431 // seconds after there are no longer any active connections. | 431 // seconds after there are no longer any active connections. |
| 432 // |
| 433 // The analyser node also requires special handling because we |
| 434 // need the internal state to be updated for the time and FFT data |
| 435 // even if it has no connections. |
| 432 if (getNodeType() != NodeTypeConvolver && getNodeType() != NodeTypeDelay && | 436 if (getNodeType() != NodeTypeConvolver && getNodeType() != NodeTypeDelay && |
| 433 getNodeType() != NodeTypeBiquadFilter && | 437 getNodeType() != NodeTypeBiquadFilter && |
| 434 getNodeType() != NodeTypeIIRFilter) { | 438 getNodeType() != NodeTypeIIRFilter && |
| 439 getNodeType() != NodeTypeAnalyser) { |
| 435 m_isDisabled = true; | 440 m_isDisabled = true; |
| 436 clearInternalStateWhenDisabled(); | 441 clearInternalStateWhenDisabled(); |
| 437 for (auto& output : m_outputs) | 442 for (auto& output : m_outputs) |
| 438 output->disable(); | 443 output->disable(); |
| 439 } | 444 } |
| 440 } | 445 } |
| 441 } | 446 } |
| 442 | 447 |
| 443 void AudioHandler::makeConnection() { | 448 void AudioHandler::makeConnection() { |
| 444 atomicIncrement(&m_connectionRefCount); | 449 atomicIncrement(&m_connectionRefCount); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 } | 952 } |
| 948 | 953 |
| 949 void AudioNode::didAddOutput(unsigned numberOfOutputs) { | 954 void AudioNode::didAddOutput(unsigned numberOfOutputs) { |
| 950 m_connectedNodes.push_back(nullptr); | 955 m_connectedNodes.push_back(nullptr); |
| 951 DCHECK_EQ(numberOfOutputs, m_connectedNodes.size()); | 956 DCHECK_EQ(numberOfOutputs, m_connectedNodes.size()); |
| 952 m_connectedParams.push_back(nullptr); | 957 m_connectedParams.push_back(nullptr); |
| 953 DCHECK_EQ(numberOfOutputs, m_connectedParams.size()); | 958 DCHECK_EQ(numberOfOutputs, m_connectedParams.size()); |
| 954 } | 959 } |
| 955 | 960 |
| 956 } // namespace blink | 961 } // namespace blink |
| OLD | NEW |