From 61a04d906a6fe6ed5f02de698a9e4dce2d682070 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:45:24 +0200 Subject: [PATCH] docs: add missing + fix docs in wrong place --- src/decoder/symphonia.rs | 3 ++- src/source/blt.rs | 1 + src/source/channel_volume.rs | 7 +++++-- src/source/empty_callback.rs | 4 ++-- src/source/mod.rs | 5 ++++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/decoder/symphonia.rs b/src/decoder/symphonia.rs index 31099177..06380c7a 100644 --- a/src/decoder/symphonia.rs +++ b/src/decoder/symphonia.rs @@ -208,6 +208,7 @@ impl Source for SymphoniaDecoder { } } +/// Error returned when the try_seek implementation of the symphonia decoder fails. #[derive(Debug, thiserror::Error)] pub enum SeekError { /// Could not get next packet while refining seek position @@ -225,7 +226,7 @@ pub enum SeekError { } impl SymphoniaDecoder { - /// note frame offset must be set after + /// Note frame offset must be set after fn refine_position(&mut self, seek_res: SeekedTo) -> Result<(), source::SeekError> { let mut samples_to_pass = seek_res.required_ts - seek_res.actual_ts; let packet = loop { diff --git a/src/source/blt.rs b/src/source/blt.rs index 853b6974..c7be7310 100644 --- a/src/source/blt.rs +++ b/src/source/blt.rs @@ -54,6 +54,7 @@ where } } +/// This applies an audio filter, it can be a high or low pass filter. #[derive(Clone, Debug)] pub struct BltFilter { input: I, diff --git a/src/source/channel_volume.rs b/src/source/channel_volume.rs index 30962113..89412372 100644 --- a/src/source/channel_volume.rs +++ b/src/source/channel_volume.rs @@ -25,6 +25,9 @@ where I: Source, I::Item: Sample, { + /// Wrap the input source and make it mono. Play that mono sound to each + /// channel at the volume set by the user. The volume can be changed using + /// [`ChannelVolume::set_volume`]. pub fn new(mut input: I, channel_volumes: Vec) -> ChannelVolume where I: Source, @@ -48,8 +51,8 @@ where } } - /// Sets the volume for a given channel number. Will panic if channel number - /// was invalid. + /// Sets the volume for a given channel number. Will panic if channel number + /// is invalid. pub fn set_volume(&mut self, channel: usize, volume: f32) { self.channel_volumes[channel] = volume; } diff --git a/src/source/empty_callback.rs b/src/source/empty_callback.rs index cb74adfc..ad1c66b8 100644 --- a/src/source/empty_callback.rs +++ b/src/source/empty_callback.rs @@ -7,7 +7,9 @@ use super::SeekError; /// An empty source which executes a callback function pub struct EmptyCallback { + #[allow(missing_docs)] // See: https://github.com/RustAudio/rodio/issues/615 pub phantom_data: PhantomData, + #[allow(missing_docs)] // See: https://github.com/RustAudio/rodio/issues/615 pub callback: Box, } @@ -19,9 +21,7 @@ impl EmptyCallback { /// Detect and do something when the source before this one has ended. pub fn new(callback: Box) -> EmptyCallback { EmptyCallback { - #[allow(missing_docs)] // See: https://github.com/RustAudio/rodio/issues/615 phantom_data: PhantomData, - #[allow(missing_docs)] // See: https://github.com/RustAudio/rodio/issues/615 callback, } } diff --git a/src/source/mod.rs b/src/source/mod.rs index dcb9f228..00dc51ac 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -465,7 +465,10 @@ where pub enum SeekError { /// On of the underlying sources does not support seeking #[error("Seeking is not supported by source: {underlying_source}")] - NotSupported { underlying_source: &'static str }, + NotSupported { + /// The source that did not support seek + underlying_source: &'static str + }, #[cfg(feature = "symphonia")] /// The symphonia decoder ran into an issue #[error("Error seeking: {0}")]