From 599b5c96be05f0ae83e76363a55ea554afb0d26f Mon Sep 17 00:00:00 2001 From: dvdsk Date: Wed, 9 Oct 2024 19:19:04 +0200 Subject: [PATCH] small language tweaks to speed docs --- src/sink.rs | 16 +++++++++++++--- src/source/mod.rs | 22 ++++++++++++---------- src/spatial_sink.rs | 18 ++++++++++++++---- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/sink.rs b/src/sink.rs index 1aabd85d..a88f5a32 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -180,10 +180,20 @@ impl Sink { *self.controls.volume.lock().unwrap() = value; } - /// Gets the speed of the sound. + /// Changes the play speed of the sound. Does not adjust the samples, only the playback speed. /// - /// The value `1.0` is the "normal" speed (unfiltered input). Any value other than `1.0` will - /// change the play speed of the sound. + /// # Note: + /// 1. **Increasing the speed will increase the pitch by the same factor** + /// - If you set the speed to 0.5 will halve the frequency of the sound + /// lowering its pitch. + /// - If you set the speed to 2 the frequency will double raising the + /// pitch of the sound. + /// 2. **Change in the speed affect the total duration inversely** + /// - If you set the speed to 0.5, the total duration will be twice as long. + /// - If you set the speed to 2 the total duration will be halve of what it + /// was. + /// + /// See [`Speed`] for details #[inline] pub fn speed(&self) -> f32 { *self.controls.speed.lock().unwrap() diff --git a/src/source/mod.rs b/src/source/mod.rs index bbb25d52..b27eb649 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -411,16 +411,18 @@ where periodic::periodic(self, period, access) } - /// Changes the play speed of the sound. Does not adjust the samples, only the play speed. - /// - /// Creates a [`Speed`] struct that handles the speed control - /// #### Note: - /// 1. **Increasing the speed would also increase the pitch by the same factor** - /// - If you increased set the speed to 0.5, the frequency would be slower (0.5x the original frequency) . - /// - Also if you set the speed to 1.5 the frequency would be faster ( 1.5x the original frequency). - /// 2. **Change in the speed would affect your total duration inversely** - /// - if you set the speed by 0.5, your total duration would be (2x the original total duration) longer. - /// - Also if you set the speed to 2 the total duration would be (0.5 the original total_duration) shorter + /// Changes the play speed of the sound. Does not adjust the samples, only the playback speed. + /// + /// # Note: + /// 1. **Increasing the speed will increase the pitch by the same factor** + /// - If you set the speed to 0.5 will halve the frequency of the sound + /// lowering its pitch. + /// - If you set the speed to 2 the frequency will double raising the + /// pitch of the sound. + /// 2. **Change in the speed affect the total duration inversely** + /// - If you set the speed to 0.5, the total duration will be twice as long. + /// - If you set the speed to 2 the total duration will be halve of what it + /// was. /// /// See [`Speed`] for details #[inline] diff --git a/src/spatial_sink.rs b/src/spatial_sink.rs index cc148f71..3cd6e0fa 100644 --- a/src/spatial_sink.rs +++ b/src/spatial_sink.rs @@ -96,10 +96,20 @@ impl SpatialSink { self.sink.set_volume(value); } - /// Gets the speed of the sound. - /// - /// The value `1.0` is the "normal" speed (unfiltered input). Any value other than `1.0` will - /// change the play speed of the sound. + /// Changes the play speed of the sound. Does not adjust the samples, only the playback speed. + /// + /// # Note: + /// 1. **Increasing the speed will increase the pitch by the same factor** + /// - If you set the speed to 0.5 will halve the frequency of the sound + /// lowering its pitch. + /// - If you set the speed to 2 the frequency will double raising the + /// pitch of the sound. + /// 2. **Change in the speed affect the total duration inversely** + /// - If you set the speed to 0.5, the total duration will be twice as long. + /// - If you set the speed to 2 the total duration will be halve of what it + /// was. + /// + /// See [`Speed`] for details #[inline] pub fn speed(&self) -> f32 { self.sink.speed()