Process the given buffers of audio data.
(
&mut self,
input: &dyn Adapter<'_, f32>,
output: &mut dyn AdapterMut<'_, f32>,
info: BackendProcessInfo,
)
| 34 | pub fn process( |
| 35 | &mut self, |
| 36 | input: &dyn Adapter<f32>, |
| 37 | output: &mut dyn AdapterMut<f32>, |
| 38 | info: BackendProcessInfo, |
| 39 | ) { |
| 40 | let BackendProcessInfo { |
| 41 | frames, |
| 42 | process_timestamp, |
| 43 | duration_since_stream_start, |
| 44 | input_stream_status, |
| 45 | mut output_stream_status, |
| 46 | mut dropped_frames, |
| 47 | process_to_playback_delay, |
| 48 | } = info; |
| 49 | |
| 50 | let process_timestamp = process_timestamp.unwrap_or_else(Instant::now); |
| 51 | |
| 52 | let total_cpu_seconds_recip = ((frames as f64 * self.sample_rate_recip) |
| 53 | - SYSTEM_OVERHEAD_DURATION_SECS) |
| 54 | .max(SYSTEM_OVERHEAD_DURATION_SECS) |
| 55 | .recip(); |
| 56 | |
| 57 | self.profiler_tx |
| 58 | .new_process_loop(process_timestamp, total_cpu_seconds_recip, &self.flags); |
| 59 | |
| 60 | let num_in_channels = input.channels(); |
| 61 | let num_out_channels = output.channels(); |
| 62 | |
| 63 | if input_stream_status.contains(StreamStatus::INPUT_OVERFLOW) { |
| 64 | let mut do_send = true; |
| 65 | if let Some(instant) = self.last_input_overflow_log_instant |
| 66 | && let Some(duration) = process_timestamp.checked_duration_since(instant) |
| 67 | { |
| 68 | do_send = duration >= UNDERFLOW_LOG_COOLDOWN; |
| 69 | } |
| 70 | |
| 71 | if do_send { |
| 72 | self.last_input_overflow_log_instant = Some(process_timestamp); |
| 73 | let _ = self.extra.logger.try_error("Firewheel input to output stream channel overflowed! Try increasing the capacity of the channel."); |
| 74 | } |
| 75 | } |
| 76 | if input_stream_status.contains(StreamStatus::OUTPUT_UNDERFLOW) { |
| 77 | let mut do_send = true; |
| 78 | if let Some(instant) = self.last_output_underflow_log_instant |
| 79 | && let Some(duration) = process_timestamp.checked_duration_since(instant) |
| 80 | { |
| 81 | do_send = duration >= UNDERFLOW_LOG_COOLDOWN; |
| 82 | } |
| 83 | |
| 84 | if do_send { |
| 85 | self.last_output_underflow_log_instant = Some(process_timestamp); |
| 86 | let _ = self.extra.logger.try_error("Firewheel input to output stream channel underflowed! Try increasing the latency of the channel."); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // --- Poll messages ------------------------------------------------------------------ |
| 91 | |
| 92 | self.poll_messages(); |
| 93 |
no test coverage detected