Skip to content

Commit

Permalink
Resolution of comment on source speed documentation
Browse files Browse the repository at this point in the history
I added docs on the effects of changing the speed on both total_duration and pitch on both the source.speed trait and sink set_speed functions .
This should help users understand what each function does
  • Loading branch information
ugochukwu-850 committed Oct 9, 2024
1 parent bb341a5 commit 5e038a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ impl Sink {
/// 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 that changing the speed would affect the pitch accordingly**
/// #### 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
#[inline]
pub fn set_speed(&self, value: f32) {
*self.controls.speed.lock().unwrap() = value;
Expand Down
2 changes: 1 addition & 1 deletion src/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ where
/// 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
///
///
/// See [`Speed`] for details
#[inline]
fn speed(self, ratio: f32) -> Speed<Self>
Expand Down

0 comments on commit 5e038a6

Please sign in to comment.