(
&mut self,
node_id: NodeID,
node_entry: &mut NodeEntry,
block_frames: usize,
clock_samples: InstantSamples,
info: &mut ProcInfo,
extra: &mut P
| 565 | } |
| 566 | |
| 567 | // Keep track of the number of elapsed schedueld events this |
| 568 | // block to further optimize the linear search. |
| 569 | node_entry.event_data.num_scheduled_events_this_block += 1; |
| 570 | } else { |
| 571 | self.scheduled_event_arena[*slot as usize] = None; |
| 572 | } |
| 573 | |
| 574 | self.num_elapsed_sorted_events += 1; |
| 575 | } else { |
| 576 | // The event happens after this processing block, so we are done |
| 577 | // searching. |
| 578 | break; |
| 579 | } |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | /// Process in sub-chunks for each new scheduled event (or process a single |
| 584 | /// chunk if there are no scheduled events). |
| 585 | #[expect(clippy::too_many_arguments, reason = "Function needs many arguments")] |
| 586 | pub fn process_node( |
| 587 | &mut self, |
| 588 | node_id: NodeID, |
| 589 | node_entry: &mut NodeEntry, |
| 590 | block_frames: usize, |
| 591 | clock_samples: InstantSamples, |
| 592 | info: &mut ProcInfo, |
| 593 | extra: &mut ProcExtra, |
| 594 | proc_event_queue: &mut Vec<ProcEventsIndex>, |
| 595 | mut proc_buffers: ProcBuffers, |
| 596 | mut on_sub_chunk: impl FnMut(ProcessSubChunkInfo), |
| 597 | ) { |
| 598 | // Rust is getting confused when the cfg is put on the argument for some reason, |
| 599 | // so just duplicate the closure. |
| 600 | #[cfg(not(feature = "scheduled_events"))] |
| 601 | let push_event = |node_event_queue: &mut Vec<ProcEventsIndex>, |
| 602 | immediate_event_buffer: &[Option<NodeEvent>], |
| 603 | event: ProcEventsIndex, |
| 604 | logger: &mut RealtimeLogger, |
| 605 | set_bypassed: &mut Option<bool>| { |
| 606 | match event { |
| 607 | ProcEventsIndex::Immediate(i) => { |
| 608 | if let Some(event) = immediate_event_buffer |
| 609 | .get(i as usize) |
| 610 | .and_then(|e| e.as_ref()) |
| 611 | && let NodeEventType::SetBypassed(bypassed) = &event.event |
| 612 | { |
| 613 | *set_bypassed = Some(*bypassed); |
| 614 | return; |
| 615 | } |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | if node_event_queue.len() == node_event_queue.capacity() { |
| 620 | match self.buffer_out_of_space_mode { |
| 621 | BufferOutOfSpaceMode::AllocateOnAudioThread => { |
| 622 | let _ = logger.try_error("Firewheel event queue is full! Please increase FirewheelConfig::event_queue_capacity to avoid audio glitches."); |
| 623 | } |
| 624 | BufferOutOfSpaceMode::Panic => { |
no test coverage detected