| 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 class AudioNode; | 35 class AudioNode; |
| 36 class AudioNodeOutput; | 36 class AudioNodeOutput; |
| 37 | 37 |
| 38 // An AudioNodeInput represents an input to an AudioNode and can be connected fr
om one or more AudioNodeOutputs. | 38 // An AudioNodeInput represents an input to an AudioNode and can be connected fr
om one or more AudioNodeOutputs. |
| 39 // In the case of multiple connections, the input will act as a unity-gain summi
ng junction, mixing all the outputs. | 39 // In the case of multiple connections, the input will act as a unity-gain summi
ng junction, mixing all the outputs. |
| 40 // The number of channels of the input's bus is the maximum of the number of cha
nnels of all its connections. | 40 // The number of channels of the input's bus is the maximum of the number of cha
nnels of all its connections. |
| 41 | 41 |
| 42 class AudioNodeInput FINAL : public AudioSummingJunction { | 42 class AudioNodeInput FINAL : public AudioSummingJunction { |
| 43 public: | 43 public: |
| 44 static PassOwnPtrWillBeRawPtr<AudioNodeInput> create(AudioNode&); | 44 static AudioNodeInput* create(AudioNode&); |
| 45 | 45 |
| 46 // AudioSummingJunction | 46 // AudioSummingJunction |
| 47 virtual void trace(Visitor*) OVERRIDE; | 47 virtual void trace(Visitor*) OVERRIDE; |
| 48 virtual bool canUpdateState() OVERRIDE { return !node().isDisposeCalled(); } | 48 virtual bool canUpdateState() OVERRIDE { return !node().isDisposeCalled(); } |
| 49 virtual void didUpdate() OVERRIDE; | 49 virtual void didUpdate() OVERRIDE; |
| 50 | 50 |
| 51 // Can be called from any thread. | 51 // Can be called from any thread. |
| 52 AudioNode& node() const { return *m_node; } | 52 AudioNode& node() const { return *m_node; } |
| 53 | 53 |
| 54 // Must be called with the context's graph lock. | 54 // Must be called with the context's graph lock. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 // updateInternalBus() updates m_internalSummingBus appropriately for the nu
mber of channels. | 75 // updateInternalBus() updates m_internalSummingBus appropriately for the nu
mber of channels. |
| 76 // This must be called when we own the context's graph lock in the audio thr
ead at the very start or end of the render quantum. | 76 // This must be called when we own the context's graph lock in the audio thr
ead at the very start or end of the render quantum. |
| 77 void updateInternalBus(); | 77 void updateInternalBus(); |
| 78 | 78 |
| 79 // The number of channels of the connection with the largest number of chann
els. | 79 // The number of channels of the connection with the largest number of chann
els. |
| 80 unsigned numberOfChannels() const; | 80 unsigned numberOfChannels() const; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 explicit AudioNodeInput(AudioNode&); | 83 explicit AudioNodeInput(AudioNode&); |
| 84 | 84 |
| 85 RawPtrWillBeMember<AudioNode> m_node; | 85 Member<AudioNode> m_node; |
| 86 | 86 |
| 87 // m_disabledOutputs contains the AudioNodeOutputs which are disabled (will
not be processed) by the audio graph rendering. | 87 // m_disabledOutputs contains the AudioNodeOutputs which are disabled (will
not be processed) by the audio graph rendering. |
| 88 // But, from JavaScript's perspective, these outputs are still connected to
us. | 88 // But, from JavaScript's perspective, these outputs are still connected to
us. |
| 89 // Generally, these represent disabled connections from "notes" which have f
inished playing but are not yet garbage collected. | 89 // Generally, these represent disabled connections from "notes" which have f
inished playing but are not yet garbage collected. |
| 90 // Oilpan: Since items are added to the hash set by the audio thread (not re
gistered to Oilpan), | 90 // Oilpan: Since items are added to the hash set by the audio thread (not re
gistered to Oilpan), |
| 91 // we cannot use a HeapHashSet. | 91 // we cannot use a HeapHashSet. |
| 92 GC_PLUGIN_IGNORE("") |
| 92 HashSet<AudioNodeOutput*> m_disabledOutputs; | 93 HashSet<AudioNodeOutput*> m_disabledOutputs; |
| 93 | 94 |
| 94 // Called from context's audio thread. | 95 // Called from context's audio thread. |
| 95 AudioBus* internalSummingBus(); | 96 AudioBus* internalSummingBus(); |
| 96 void sumAllConnections(AudioBus* summingBus, size_t framesToProcess); | 97 void sumAllConnections(AudioBus* summingBus, size_t framesToProcess); |
| 97 | 98 |
| 98 RefPtr<AudioBus> m_internalSummingBus; | 99 RefPtr<AudioBus> m_internalSummingBus; |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace blink | 102 } // namespace blink |
| 102 | 103 |
| 103 #endif // AudioNodeInput_h | 104 #endif // AudioNodeInput_h |
| OLD | NEW |