The realtime process method. This is always called in a realtime thread, so do not perform any realtime-unsafe operations.
(
&mut self,
// Information about the process block.
info: &ProcInfo,
// The buffers of data to process.
buffers: ProcBuffers,
// Extra buffers and util
| 189 | // Called when the node has been fully bypassed/un-bypassed. |
| 190 | // |
| 191 | // The Firewheel processor automatically handles bypass declicking, so |
| 192 | // there is no need to handle that manually. |
| 193 | // |
| 194 | // This is always called in a realtime thread, so do not perform any |
| 195 | // realtime-unsafe operations. |
| 196 | fn bypassed(&mut self, _bypassed: bool) { |
| 197 | self.reset(); |
| 198 | } |
| 199 | |
| 200 | // The realtime process method. |
| 201 | // |
| 202 | // This is always called in a realtime thread, so do not perform any |
| 203 | // realtime-unsafe operations. |
| 204 | fn process( |
| 205 | &mut self, |
| 206 | // Information about the process block. |
| 207 | info: &ProcInfo, |
| 208 | // The buffers of data to process. |
| 209 | buffers: ProcBuffers, |
| 210 | // Extra buffers and utilities. |
| 211 | _extra: &mut ProcExtra, |
| 212 | ) -> ProcessStatus { |
| 213 | // If the gain parameter is not currently smoothing and is silent, then |
| 214 | // there is no need to process. |
| 215 | let gain_is_silent = self.gain.has_settled_at_or_below(DEFAULT_MIN_AMP); |
| 216 | |
| 217 | // Read the output silence mask since we are operating with in-place buffers. |
| 218 | if info.out_silence_mask.all_channels_silent(2) || gain_is_silent { |
| 219 | // Outputs will be silent, so no need to process. |
| 220 | |
| 221 | // Reset the smoothers and filters since they don't need to smooth any |
| 222 | // output. |
| 223 | self.reset(); |
| 224 | |
| 225 | return ProcessStatus::ClearAllOutputs; |
| 226 | } |
| 227 | |
| 228 | // Get slices of the output buffers. |
| 229 | // |
| 230 | // Doing it this way allows the compiler to better optimize the processing |
| 231 | // loops below. |
| 232 | let (out1, out2) = buffers.outputs.split_first_mut().unwrap(); |
| 233 | let out1 = &mut out1[..info.frames]; |
| 234 | let out2 = &mut out2[0][..info.frames]; |
| 235 | |
| 236 | // Retrieve a buffer of the smoothed gain values. |
| 237 | // |
| 238 | // The redundant slicing is not strictly necessary, but it may help make sure |
| 239 | // the compiler properly optimizes the below processing loops. |
| 240 | let gain = &self.gain.get_buffer(info.frames).0[..info.frames]; |
| 241 | |
| 242 | if self.cutoff_hz.is_smoothing() { |
| 243 | for i in 0..info.frames { |
| 244 | let cutoff_hz = self.cutoff_hz.next_smoothed(); |
| 245 | |
| 246 | // Because recalculating filter coefficients is expensive, a trick like |
| 247 | // this can be used to only recalculate them every 16 frames. |
| 248 | if self.coeff_update_mask.do_update(i) { |
nothing calls this directly
no test coverage detected