(
&mut self,
info: &ProcInfo,
buffers: ProcBuffers,
extra: &mut ProcExtra,
)
| 327 | } |
| 328 | } |
| 329 | |
| 330 | fn bypassed(&mut self, _bypassed: bool) { |
| 331 | self.reset(); |
| 332 | } |
| 333 | |
| 334 | fn process( |
| 335 | &mut self, |
| 336 | info: &ProcInfo, |
| 337 | buffers: ProcBuffers, |
| 338 | extra: &mut ProcExtra, |
| 339 | ) -> ProcessStatus { |
| 340 | if info.in_silence_mask.all_channels_silent(2) { |
| 341 | self.reset(); |
| 342 | self.prev_input_settled = true; |
| 343 | return ProcessStatus::ClearAllOutputs; |
| 344 | } |
| 345 | |
| 346 | self.prev_input_settled = buffers.inputs_settled_at_zero(); |
| 347 | |
| 348 | let scratch_buffer = extra.scratch_buffers.first_mut(); |
| 349 | |
| 350 | let (in1, in2) = if info.in_connected_mask == ConnectedMask::STEREO_CONNECTED { |
| 351 | if self.params.downmix { |
| 352 | // Downmix the stereo signal to mono. |
| 353 | for (scratch_s, (&in1, &in2)) in scratch_buffer[..info.frames].iter_mut().zip( |
| 354 | buffers.inputs[0][..info.frames] |
| 355 | .iter() |
| 356 | .zip(buffers.inputs[1][..info.frames].iter()), |
| 357 | ) { |
| 358 | *scratch_s = (in1 + in2) * 0.5; |
| 359 | } |
| 360 | |
| 361 | ( |
| 362 | &scratch_buffer[..info.frames], |
| 363 | &scratch_buffer[..info.frames], |
| 364 | ) |
| 365 | } else { |
| 366 | ( |
| 367 | &buffers.inputs[0][..info.frames], |
| 368 | &buffers.inputs[1][..info.frames], |
| 369 | ) |
| 370 | } |
| 371 | } else { |
| 372 | // Only one (or none) channels are connected, so just use the first |
| 373 | // channel as input. |
| 374 | ( |
| 375 | &buffers.inputs[0][..info.frames], |
| 376 | &buffers.inputs[0][..info.frames], |
| 377 | ) |
| 378 | }; |
| 379 | |
| 380 | // Make doubly sure that the compiler optimizes away the bounds checking |
| 381 | // in the loop. |
| 382 | let in1 = &in1[..info.frames]; |
| 383 | let in2 = &in2[..info.frames]; |
| 384 | |
| 385 | let (out1, out2) = buffers.outputs.split_first_mut().unwrap(); |
| 386 | let out1 = &mut out1[..info.frames]; |
nothing calls this directly
no test coverage detected