mirror of
https://github.com/RustAudio/rodio
synced 2024-11-10 14:14:21 +00:00
Add inner
accessors for more sources
This commit is contained in:
parent
4bb832ba30
commit
53a7d78cd8
8 changed files with 171 additions and 0 deletions
|
@ -49,6 +49,24 @@ where
|
|||
pub fn set_volume(&mut self, channel: usize, volume: f32) {
|
||||
self.channel_volumes[channel] = volume;
|
||||
}
|
||||
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.input
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Iterator for ChannelVolume<I>
|
||||
|
|
|
@ -31,6 +31,30 @@ where
|
|||
requested_duration: Duration,
|
||||
}
|
||||
|
||||
impl<I> Delay<I>
|
||||
where
|
||||
I: Source,
|
||||
I::Item: Sample,
|
||||
{
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.input
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Iterator for Delay<I>
|
||||
where
|
||||
I: Source,
|
||||
|
|
|
@ -29,6 +29,24 @@ where
|
|||
signal_sent: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.input
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: Source> Iterator for Done<I>
|
||||
|
|
|
@ -30,6 +30,30 @@ where
|
|||
total_ns: f32,
|
||||
}
|
||||
|
||||
impl<I> FadeIn<I>
|
||||
where
|
||||
I: Source,
|
||||
I::Item: Sample,
|
||||
{
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.input
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Iterator for FadeIn<I>
|
||||
where
|
||||
I: Source,
|
||||
|
|
|
@ -38,6 +38,32 @@ pub struct PeriodicAccess<I, F> {
|
|||
samples_until_update: u32,
|
||||
}
|
||||
|
||||
impl<I, F> PeriodicAccess<I, F>
|
||||
where
|
||||
I: Source,
|
||||
I::Item: Sample,
|
||||
F: FnMut(&mut I),
|
||||
{
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.input
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl<I, F> Iterator for PeriodicAccess<I, F>
|
||||
where
|
||||
I: Source,
|
||||
|
|
|
@ -34,6 +34,24 @@ where
|
|||
dest: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.inner
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.inner
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.inner
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, D> Iterator for SamplesConverter<I, D>
|
||||
|
|
|
@ -26,6 +26,31 @@ where
|
|||
factor: f32,
|
||||
}
|
||||
|
||||
impl<I> Speed<I>
|
||||
where
|
||||
I: Source,
|
||||
I::Item: Sample,
|
||||
{
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.input
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl<I> Iterator for Speed<I>
|
||||
where
|
||||
I: Source,
|
||||
|
|
|
@ -40,6 +40,24 @@ where
|
|||
// \|/ the maximum value of `ns` is one billion, so this can't fail
|
||||
Duration::new(0, ns as u32)
|
||||
}
|
||||
|
||||
/// Returns a reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &I {
|
||||
&self.input
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the inner source.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut I {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
/// Returns the inner source.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> I {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Iterator for TakeDuration<I>
|
||||
|
|
Loading…
Reference in a new issue