| 68 | let sample_rate = (packed >> 16) as usize; |
| 69 | let channels = (packed & 0xffff) as usize; |
| 70 | *slot = Some(Box::new(WetDelays::new(sample_rate, channels))); |
| 71 | } |
| 72 | |
| 73 | // Audio side: take the staged delay lines if any are ready. Never blocks. |
| 74 | fn take_wet_delays(&self) -> Option<Box<WetDelays>> { |
| 75 | self.pending_wet.try_lock().ok()?.take() |
| 76 | } |
| 77 | |
| 78 | pub(crate) fn update_spatial(&self, params: SpatialAudioParams) { |
| 79 | self.low_pass |
| 80 | .store(params.low_pass.clamp(0.0, 1.0).to_bits(), Ordering::Relaxed); |
| 81 | self.reverb_send.store( |
| 82 | params.reverb_send.clamp(0.0, 1.0).to_bits(), |
| 83 | Ordering::Relaxed, |
| 84 | ); |
| 85 | self.echo |
| 86 | .store(params.echo.clamp(0.0, 1.0).to_bits(), Ordering::Relaxed); |
| 87 | self.reflection.store( |
| 88 | params.reflection.clamp(0.0, 1.0).to_bits(), |
| 89 | Ordering::Relaxed, |
| 90 | ); |
| 91 | self.occlusion.store( |
| 92 | params.occlusion.clamp(0.0, 1.0).to_bits(), |