From 42fe8320aa24b3b4f62e5bf9a1003aac6c559761 Mon Sep 17 00:00:00 2001 From: UnknownSuperficialNight <88142731+UnknownSuperficialNight@users.noreply.github.com> Date: Tue, 1 Oct 2024 01:46:55 +1300 Subject: [PATCH] Enhance automatic_gain_control documentation - Add references to get_agc_control method in automatic_gain_control docs - Include a quick start example demonstrating usage of get_agc_control --- src/source/mod.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/source/mod.rs b/src/source/mod.rs index da7c04bc..75dd7e20 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -286,6 +286,27 @@ where /// This is crucial for maintaining audio quality and preventing unexpected volume spikes. /// A recommended value for `absolute_max_gain` is `5`, which provides a good balance between /// amplification capability and protection against distortion in most scenarios. + /// + /// Use `get_agc_control` to obtain a handle for real-time enabling/disabling of the AGC. + /// + /// # Example (Quick start) + /// + /// ```rust + /// // Apply Automatic Gain Control to the source (AGC is on by default) + /// let agc_source = source.automatic_gain_control(1.0, 4.0, 0.005, 5.0); + /// + /// // Get a handle to control the AGC's enabled state (optional) + /// let agc_control = agc_source.get_agc_control(); + /// + /// // You can toggle AGC on/off at any time (optional) + /// agc_control.store(false, std::sync::atomic::Ordering::Relaxed); + /// + /// // Add the AGC-controlled source to the sink + /// sink.append(agc_source); + /// + /// // Note: Using agc_control is optional. If you don't need to toggle AGC, + /// // you can simply use the agc_source directly without getting agc_control. + /// ``` #[inline] fn automatic_gain_control( self,