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

Class AudioNode

include/LabSound/core/AudioNode.h:83–249  ·  view source on GitHub ↗

AudioNode is the basic building block for a signal processing graph. It may be an audio source, an intermediate processing module, or an audio destination. Each AudioNode can have inputs and/or outputs. An AudioHardwareDeviceNode has one input and no outputs and represents the final destination to the audio hardware. Most processing nodes such as filters will have one input and one output,

Source from the content-addressed store, hash-verified

81// Most processing nodes such as filters will have one input and one output,
82//
83class AudioNode
84{
85 static void _printGraph(const AudioNode * root,
86 std::function<void(const char *)> prnln, int indent);
87
88public :
89 enum : int
90 {
91 ProcessingSizeInFrames = 128
92 };
93
94 int color = 0;
95
96 AudioNode() = delete;
97 virtual ~AudioNode();
98
99 explicit AudioNode(AudioContext &, AudioNodeDescriptor const &);
100
101 static void printGraph(const AudioNode* root,
102 std::function<void(const char *)> prnln);
103
104 //--------------------------------------------------
105 // required interface
106 //
107 virtual const char* name() const = 0;
108
109 // The input busses (if any) will already have their input data available
110 // when process() is called. Subclasses will take this input data and
111 // render into this node's output buses.
112 // Called from context's audio thread.
113 virtual void process(ContextRenderLock &, int bufferSize) = 0;
114
115 // Resets DSP processing state (clears delay lines, filter memory, etc.)
116 // Called from context's audio thread.
117 virtual void reset(ContextRenderLock &) = 0;
118
119 // tailTime() is the length of time (not counting latency time) where
120 // non-zero output may occur after continuous silent input.
121 virtual double tailTime(ContextRenderLock & r) const = 0;
122
123 // latencyTime() is the length of time it takes for non-zero output to
124 // appear after non-zero input is provided. This only applies to processing
125 // delay which is an artifact of the processing algorithm chosen and is
126 // *not* part of the intrinsic desired effect. For example, a "delay"
127 // effect is expected to delay the signal, and thus would not be considered
128 // latency.
129 virtual double latencyTime(ContextRenderLock & r) const = 0;
130
131 //--------------------------------------------------
132 // overridable interface
133 //
134 // If the final node class has ScheduledNode in its class hierarchy, this
135 // will return true. This is to save the cost of a dynamic_cast when
136 // scheduling nodes.
137 virtual bool isScheduledNode() const { return false; }
138
139 // No significant resources should be allocated until initialize() is called.
140 // Processing may not occur until a node is initialized.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected