Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h

Issue 2389253002: reflow comments in modules/{webaudio,vr} (Closed)
Patch Set: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 #include "modules/webaudio/AudioSummingJunction.h" 30 #include "modules/webaudio/AudioSummingJunction.h"
31 #include "platform/audio/AudioBus.h" 31 #include "platform/audio/AudioBus.h"
32 #include "wtf/Allocator.h" 32 #include "wtf/Allocator.h"
33 #include "wtf/HashSet.h" 33 #include "wtf/HashSet.h"
34 #include <memory> 34 #include <memory>
35 35
36 namespace blink { 36 namespace blink {
37 37
38 class AudioNodeOutput; 38 class AudioNodeOutput;
39 39
40 // An AudioNodeInput represents an input to an AudioNode and can be connected fr om one or more AudioNodeOutputs. 40 // An AudioNodeInput represents an input to an AudioNode and can be connected
41 // In the case of multiple connections, the input will act as a unity-gain summi ng junction, mixing all the outputs. 41 // from one or more AudioNodeOutputs. In the case of multiple connections, the
42 // The number of channels of the input's bus is the maximum of the number of cha nnels of all its connections. 42 // input will act as a unity-gain summing junction, mixing all the outputs. The
43 // number of channels of the input's bus is the maximum of the number of
44 // channels of all its connections.
43 45
44 class AudioNodeInput final : public AudioSummingJunction { 46 class AudioNodeInput final : public AudioSummingJunction {
45 USING_FAST_MALLOC(AudioNodeInput); 47 USING_FAST_MALLOC(AudioNodeInput);
46 48
47 public: 49 public:
48 static std::unique_ptr<AudioNodeInput> create(AudioHandler&); 50 static std::unique_ptr<AudioNodeInput> create(AudioHandler&);
49 51
50 // AudioSummingJunction 52 // AudioSummingJunction
51 void didUpdate() override; 53 void didUpdate() override;
52 54
53 // Can be called from any thread. 55 // Can be called from any thread.
54 AudioHandler& handler() const { return m_handler; } 56 AudioHandler& handler() const { return m_handler; }
55 57
56 // Must be called with the context's graph lock. 58 // Must be called with the context's graph lock.
57 void connect(AudioNodeOutput&); 59 void connect(AudioNodeOutput&);
58 void disconnect(AudioNodeOutput&); 60 void disconnect(AudioNodeOutput&);
59 61
60 // disable() will take the output out of the active connections list and set a side in a disabled list. 62 // disable() will take the output out of the active connections list and set
63 // aside in a disabled list.
61 // enable() will put the output back into the active connections list. 64 // enable() will put the output back into the active connections list.
62 // Must be called with the context's graph lock. 65 // Must be called with the context's graph lock.
63 void enable(AudioNodeOutput&); 66 void enable(AudioNodeOutput&);
64 void disable(AudioNodeOutput&); 67 void disable(AudioNodeOutput&);
65 68
66 // pull() processes all of the AudioNodes connected to us. 69 // pull() processes all of the AudioNodes connected to us.
67 // In the case of multiple connections it sums the result into an internal sum ming bus. 70 // In the case of multiple connections it sums the result into an internal
68 // In the single connection case, it allows in-place processing where possible using inPlaceBus. 71 // summing bus. In the single connection case, it allows in-place processing
69 // It returns the bus which it rendered into, returning inPlaceBus if in-place processing was performed. 72 // where possible using inPlaceBus. It returns the bus which it rendered
73 // into, returning inPlaceBus if in-place processing was performed.
70 // Called from context's audio thread. 74 // Called from context's audio thread.
71 AudioBus* pull(AudioBus* inPlaceBus, size_t framesToProcess); 75 AudioBus* pull(AudioBus* inPlaceBus, size_t framesToProcess);
72 76
73 // bus() contains the rendered audio after pull() has been called for each tim e quantum. 77 // bus() contains the rendered audio after pull() has been called for each
78 // time quantum.
74 // Called from context's audio thread. 79 // Called from context's audio thread.
75 AudioBus* bus(); 80 AudioBus* bus();
76 81
77 // updateInternalBus() updates m_internalSummingBus appropriately for the numb er of channels. 82 // updateInternalBus() updates m_internalSummingBus appropriately for the
78 // This must be called when we own the context's graph lock in the audio threa d at the very start or end of the render quantum. 83 // number of channels. This must be called when we own the context's graph
84 // lock in the audio thread at the very start or end of the render quantum.
79 void updateInternalBus(); 85 void updateInternalBus();
80 86
81 // The number of channels of the connection with the largest number of channel s. 87 // The number of channels of the connection with the largest number of
88 // channels.
82 unsigned numberOfChannels() const; 89 unsigned numberOfChannels() const;
83 90
84 private: 91 private:
85 explicit AudioNodeInput(AudioHandler&); 92 explicit AudioNodeInput(AudioHandler&);
86 93
87 // This reference is safe because the AudioHandler owns this AudioNodeInput 94 // This reference is safe because the AudioHandler owns this AudioNodeInput
88 // object. 95 // object.
89 AudioHandler& m_handler; 96 AudioHandler& m_handler;
90 97
91 // m_disabledOutputs contains the AudioNodeOutputs which are disabled (will 98 // m_disabledOutputs contains the AudioNodeOutputs which are disabled (will
92 // not be processed) by the audio graph rendering. But, from JavaScript's 99 // not be processed) by the audio graph rendering. But, from JavaScript's
93 // perspective, these outputs are still connected to us. 100 // perspective, these outputs are still connected to us.
94 // Generally, these represent disabled connections from "notes" which have 101 // Generally, these represent disabled connections from "notes" which have
95 // finished playing but are not yet garbage collected. 102 // finished playing but are not yet garbage collected.
96 // These raw pointers are safe. Owner AudioNodes of these AudioNodeOutputs 103 // These raw pointers are safe. Owner AudioNodes of these AudioNodeOutputs
97 // manage their lifetime, and AudioNode::dispose() disconnects all of 104 // manage their lifetime, and AudioNode::dispose() disconnects all of
98 // connections. 105 // connections.
99 HashSet<AudioNodeOutput*> m_disabledOutputs; 106 HashSet<AudioNodeOutput*> m_disabledOutputs;
100 107
101 // Called from context's audio thread. 108 // Called from context's audio thread.
102 AudioBus* internalSummingBus(); 109 AudioBus* internalSummingBus();
103 void sumAllConnections(AudioBus* summingBus, size_t framesToProcess); 110 void sumAllConnections(AudioBus* summingBus, size_t framesToProcess);
104 111
105 RefPtr<AudioBus> m_internalSummingBus; 112 RefPtr<AudioBus> m_internalSummingBus;
106 }; 113 };
107 114
108 } // namespace blink 115 } // namespace blink
109 116
110 #endif // AudioNodeInput_h 117 #endif // AudioNodeInput_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698