Called when a new stream has been created. Because the new stream may have a different sample rate from the old one, make sure to update any calculations that depend on the sample rate. This gets called outside of the audio thread, so it is safe to allocate and deallocate here.
(&mut self, stream_info: &StreamInfo, _context: &mut ProcStreamCtx)
| 269 | // This gets called outside of the audio thread, so it is safe to allocate and |
| 270 | // deallocate here. |
| 271 | fn new_stream(&mut self, stream_info: &StreamInfo, _context: &mut ProcStreamCtx) { |
| 272 | self.window_frames = |
| 273 | (self.params.window_size_secs * stream_info.sample_rate.get() as f32).round() as usize; |
| 274 | |
| 275 | self.squares = 0.0; |
| 276 | self.num_squared_values = 0; |
| 277 | } |
| 278 | } |