MCPcopy Create free account
hub / github.com/LabSound/LabSound / AudioNodeInput

Class AudioNodeInput

include/LabSound/core/AudioNodeInput.h:23–56  ·  view source on GitHub ↗

An AudioNodeInput represents an input to an AudioNode and can be connected from one or more AudioNodeOutputs. In the case of multiple connections, the input will act as a unity-gain summing junction, mixing all the outputs. The number of channels of the input's bus is the maximum of the number of channels of all its connections.

Source from the content-addressed store, hash-verified

21// In the case of multiple connections, the input will act as a unity-gain summing junction, mixing all the outputs.
22// The number of channels of the input's bus is the maximum of the number of channels of all its connections.
23class AudioNodeInput : public AudioSummingJunction
24{
25 AudioNode * m_destinationNode;
26 std::unique_ptr<AudioBus> m_internalSummingBus;
27
28public:
29 explicit AudioNodeInput(AudioNode * audioNode, int processingSizeInFrames = AudioNode::ProcessingSizeInFrames);
30 virtual ~AudioNodeInput();
31
32 // Can be called from any thread.
33 AudioNode * destinationNode() const { return m_destinationNode; }
34
35 // Must be called with the context's graph lock. Static because a shared pointer to this is required
36 static void connect(ContextGraphLock &, std::shared_ptr<AudioNodeInput> fromInput, std::shared_ptr<AudioNodeOutput> toOutput);
37 static void disconnect(ContextGraphLock &, std::shared_ptr<AudioNodeInput> fromInput, std::shared_ptr<AudioNodeOutput> toOutput);
38 static void disconnectAll(ContextGraphLock&, std::shared_ptr<AudioNodeInput> fromInput);
39
40 // pull() processes all of the AudioNodes connected to this NodeInput.
41 // In the case of multiple connections, the result is summed onto the internal summing bus.
42 // In the single connection case, it allows in-place processing where possible using inPlaceBus.
43 // It returns the bus which it rendered into, returning inPlaceBus if in-place processing was performed.
44 AudioBus * pull(ContextRenderLock &, AudioBus * inPlaceBus, int bufferSize);
45
46 // bus() contains the rendered audio after pull() has been called for each time quantum.
47 AudioBus * bus(ContextRenderLock &);
48
49 // updateInternalBus() updates m_internalSummingBus appropriately for the number of channels.
50 // This must be called when we own the context's graph lock in the audio thread at the very start or end of the render quantum.
51 void updateInternalBus(ContextRenderLock &);
52
53 // The number of channels of the connection with the largest number of channels.
54 // Only valid during render quantum because it is dependent on the active bus
55 int numberOfChannels(ContextRenderLock &) const;
56};
57
58} // namespace lab
59

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected