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

Method process

src/extended/PeakCompNode.cpp:66–185  ·  view source on GitHub ↗

Processes the source to destination bus. The number of channels must match in source and destination.

Source from the content-addressed store, hash-verified

64
65 // Processes the source to destination bus. The number of channels must match in source and destination.
66 virtual void process(ContextRenderLock & r, const lab::AudioBus * sourceBus, lab::AudioBus * destinationBus, int framesToProcess) override
67 {
68 int sourceNumChannels = sourceBus->numberOfChannels();
69 int destNumChannels = destinationBus->numberOfChannels();
70
71 if (!destNumChannels)
72 return;
73
74 // Get sample rate
75 internalSampleRate = r.context()->sampleRate();
76 oneOverSampleRate = 1.0 / internalSampleRate;
77
78 // copy attributes to run time variables
79 /// @fixme these values should be per sample, not per quantum
80 /// -or- they should be settings if they don't vary per sample
81 float v = m_threshold->value();
82 if (v <= 0)
83 {
84 // dB to linear (could use the function from m_pd.h)
85 threshold = powf(10.f, (v * 0.05f));
86 }
87 else
88 threshold = 0;
89
90 /// @fixme these values should be per sample, not per quantum
91 /// -or- they should be settings if they don't vary per sample
92 v = m_ratio->value();
93 if (v >= 1)
94 {
95 ratio = 1.f / v;
96 }
97 else
98 ratio = 1;
99
100 /// @fixme these values should be per sample, not per quantum
101 /// -or- they should be settings if they don't vary per sample
102 v = m_attack->value();
103 if (v >= 0.001f)
104 {
105 attack = v * 0.001;
106 }
107 else
108 attack = 0.000001;
109
110 /// @fixme these values should be per sample, not per quantum
111 /// -or- they should be settings if they don't vary per sample
112 v = m_release->value();
113 if (v >= 0.001f)
114 {
115 release = v * 0.001;
116 }
117 else
118 release = 0.000001;
119
120 /// @fixme these values should be per sample, not per quantum
121 /// -or- they should be settings if they don't vary per sample
122 v = m_makeup->value();
123 // dB to linear (could use the function from m_pd.h)

Callers

nothing calls this directly

Calls 7

channelMethod · 0.80
mutableDataMethod · 0.80
numberOfChannelsMethod · 0.45
sampleRateMethod · 0.45
contextMethod · 0.45
valueMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected