The trait describing the realtime processor counterpart to an audio node.
| 484 | /// The trait describing the realtime processor counterpart to an |
| 485 | /// audio node. |
| 486 | pub trait AudioNodeProcessor: 'static + Send { |
| 487 | /// Called when there are new events for this node to process. |
| 488 | /// |
| 489 | /// This is called once before the first call to `process`, and after that |
| 490 | /// it will be called whenever there are new events (including when the |
| 491 | /// node is bypassed). |
| 492 | /// |
| 493 | /// Unless this node is bypassed, then [`AudioNodeProcessor::process`] will be |
| 494 | /// called immediately after. |
| 495 | /// |
| 496 | /// * `info` - Information about this processing block. |
| 497 | /// * `events` - A list of events for this node to process. |
| 498 | /// * `extra` - Additional buffers and utilities. |
| 499 | /// |
| 500 | /// This is always called in a realtime thread, so do not perform any |
| 501 | /// realtime-unsafe operations. |
| 502 | fn events(&mut self, info: &ProcInfo, events: &mut ProcEvents, extra: &mut ProcExtra) { |
| 503 | let _ = info; |
| 504 | let _ = events; |
| 505 | let _ = extra; |
| 506 | } |
| 507 | |
| 508 | /// Called when the node has been fully bypassed/un-bypassed. |
| 509 | /// |
| 510 | /// The Firewheel processor automatically handles bypass declicking, so |
| 511 | /// there is no need to handle that manually. |
| 512 | /// |
| 513 | /// This is always called in a realtime thread, so do not perform any |
| 514 | /// realtime-unsafe operations. |
| 515 | fn bypassed(&mut self, bypassed: bool) { |
| 516 | let _ = bypassed; |
| 517 | } |
| 518 | |
| 519 | /// Process the given block of audio. |
| 520 | /// |
| 521 | /// * `info` - Information about this processing block. |
| 522 | /// * `buffers` - The buffers of data to process. |
| 523 | /// * `extra` - Additional buffers and utilities. |
| 524 | /// |
| 525 | /// WARNING: Audio nodes *MUST* either completely fill all output buffers |
| 526 | /// with data, or return [`ProcessStatus::ClearAllOutputs`]/[`ProcessStatus::Bypass`]. |
| 527 | /// Failing to do this will result in audio glitches. If using |
| 528 | /// [`AudioNodeInfo::in_place_buffers`], then the output buffers in the |
| 529 | /// range `[0..num_inputs_in_config.min(num_outputs_in_config)]` do not |
| 530 | /// need to be filled with data. |
| 531 | /// |
| 532 | /// This is always called in a realtime thread, so do not perform any |
| 533 | /// realtime-unsafe operations. |
| 534 | fn process( |
| 535 | &mut self, |
| 536 | info: &ProcInfo, |
| 537 | buffers: ProcBuffers, |
| 538 | extra: &mut ProcExtra, |
| 539 | ) -> ProcessStatus { |
| 540 | let _ = info; |
| 541 | let _ = buffers; |
| 542 | let _ = extra; |
| 543 |
nothing calls this directly
no outgoing calls
no test coverage detected