Skip to content

Commit a7f67b3

Browse files
committed
small language tweaks to speed docs
1 parent d1bd852 commit a7f67b3

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

src/sink.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,20 @@ impl Sink {
180180
*self.controls.volume.lock().unwrap() = value;
181181
}
182182

183-
/// Gets the speed of the sound.
183+
/// Changes the play speed of the sound. Does not adjust the samples, only the playback speed.
184184
///
185-
/// The value `1.0` is the "normal" speed (unfiltered input). Any value other than `1.0` will
186-
/// change the play speed of the sound.
185+
/// # Note:
186+
/// 1. **Increasing the speed will increase the pitch by the same factor**
187+
/// - If you set the speed to 0.5 this will halve the frequency of the sound
188+
/// lowering its pitch.
189+
/// - If you set the speed to 2 the frequency will double raising the
190+
/// pitch of the sound.
191+
/// 2. **Change in the speed affect the total duration inversely**
192+
/// - If you set the speed to 0.5, the total duration will be twice as long.
193+
/// - If you set the speed to 2 the total duration will be halve of what it
194+
/// was.
195+
///
196+
/// See [`Speed`] for details
187197
#[inline]
188198
pub fn speed(&self) -> f32 {
189199
*self.controls.speed.lock().unwrap()

src/source/mod.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -411,16 +411,18 @@ where
411411
periodic::periodic(self, period, access)
412412
}
413413

414-
/// Changes the play speed of the sound. Does not adjust the samples, only the play speed.
415-
///
416-
/// Creates a [`Speed`] struct that handles the speed control
417-
/// #### Note:
418-
/// 1. **Increasing the speed would also increase the pitch by the same factor**
419-
/// - If you increased set the speed to 0.5, the frequency would be slower (0.5x the original frequency) .
420-
/// - Also if you set the speed to 1.5 the frequency would be faster ( 1.5x the original frequency).
421-
/// 2. **Change in the speed would affect your total duration inversely**
422-
/// - if you set the speed by 0.5, your total duration would be (2x the original total duration) longer.
423-
/// - Also if you set the speed to 2 the total duration would be (0.5 the original total_duration) shorter
414+
/// Changes the play speed of the sound. Does not adjust the samples, only the playback speed.
415+
///
416+
/// # Note:
417+
/// 1. **Increasing the speed will increase the pitch by the same factor**
418+
/// - If you set the speed to 0.5 this will halve the frequency of the sound
419+
/// lowering its pitch.
420+
/// - If you set the speed to 2 the frequency will double raising the
421+
/// pitch of the sound.
422+
/// 2. **Change in the speed affect the total duration inversely**
423+
/// - If you set the speed to 0.5, the total duration will be twice as long.
424+
/// - If you set the speed to 2 the total duration will be halve of what it
425+
/// was.
424426
///
425427
/// See [`Speed`] for details
426428
#[inline]

src/spatial_sink.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,20 @@ impl SpatialSink {
9696
self.sink.set_volume(value);
9797
}
9898

99-
/// Gets the speed of the sound.
100-
///
101-
/// The value `1.0` is the "normal" speed (unfiltered input). Any value other than `1.0` will
102-
/// change the play speed of the sound.
99+
/// Changes the play speed of the sound. Does not adjust the samples, only the playback speed.
100+
///
101+
/// # Note:
102+
/// 1. **Increasing the speed will increase the pitch by the same factor**
103+
/// - If you set the speed to 0.5 this will halve the frequency of the sound
104+
/// lowering its pitch.
105+
/// - If you set the speed to 2 the frequency will double raising the
106+
/// pitch of the sound.
107+
/// 2. **Change in the speed affect the total duration inversely**
108+
/// - If you set the speed to 0.5, the total duration will be twice as long.
109+
/// - If you set the speed to 2 the total duration will be halve of what it
110+
/// was.
111+
///
112+
/// See [`Speed`] for details
103113
#[inline]
104114
pub fn speed(&self) -> f32 {
105115
self.sink.speed()

0 commit comments

Comments
 (0)