pub struct WindowedAudioSources<D> {
pub sample_rate: u32,
pub sources: HashMap<AudioStreamKey, Vec<WindowedAudioSource<D>>>,
pub byte_budget: ByteBudget,
pub retained_bytes: u64,
pub peak_bytes: u64,
/* private fields */
}Expand description
Every source stream’s windows, for one mix.
Fields§
§sample_rate: u32The rate the mix reads at.
sources: HashMap<AudioStreamKey, Vec<WindowedAudioSource<D>>>One window per disjoint range of a source stream: two clips of one media may read unrelated ranges, and one window over both would decode and retain everything between.
byte_budget: ByteBudgetA block that needs more than a scaled budget still gets up to the unscaled one
(ByteBudget::holding).
retained_bytes: u64Bytes the windows hold after the last Self::prepare.
peak_bytes: u64The most bytes the windows held after any Self::prepare.
Implementations§
Source§impl<D: WindowedAudioDecoder> WindowedAudioSources<D>
impl<D: WindowedAudioDecoder> WindowedAudioSources<D>
Sourcepub fn new(
sample_rate: u32,
byte_budget: impl Into<ByteBudget>,
open: OpenAudio<D>,
) -> Self
pub fn new( sample_rate: u32, byte_budget: impl Into<ByteBudget>, open: OpenAudio<D>, ) -> Self
Windows at sample_rate within byte_budget, opening source streams with open as the
mix first reads them.
Sourcepub fn prepare(
&mut self,
needs: &[AudioNeed],
cancel: &CancelToken,
) -> Result<(), AudioWindowError>
pub fn prepare( &mut self, needs: &[AudioNeed], cancel: &CancelToken, ) -> Result<(), AudioWindowError>
Decodes what needs reads, plus the interpolation margin, and drops unneeded windows.
§Errors
Fails with RESOURCE_LIMIT when the windows cannot fit the budget, and with the
decoder’s error or a cancellation otherwise.
Sourcepub fn rebind(&mut self, open: OpenAudio<D>, keep: impl Fn(&SourceId) -> bool)
pub fn rebind(&mut self, open: OpenAudio<D>, keep: impl Fn(&SourceId) -> bool)
Opens source streams with open from now on and keeps the windows and decoders of the
sources keep names; the others are dropped and open again when the mix reads them.
Sourcepub const fn peak_bytes(&self) -> u64
pub const fn peak_bytes(&self) -> u64
The most decoded audio the windows held at once.
Trait Implementations§
Source§impl<D: WindowedAudioDecoder> AudioBlockProvider for WindowedAudioSources<D>
impl<D: WindowedAudioDecoder> AudioBlockProvider for WindowedAudioSources<D>
Source§impl<D: WindowedAudioDecoder> ProjectAudioSources for WindowedAudioSources<D>
impl<D: WindowedAudioDecoder> ProjectAudioSources for WindowedAudioSources<D>
Source§fn prepare(
&mut self,
needs: &[AudioNeed],
cancel: &CancelToken,
) -> Result<(), AudioWindowError>
fn prepare( &mut self, needs: &[AudioNeed], cancel: &CancelToken, ) -> Result<(), AudioWindowError>
needs reads, before the block that reads it renders. Audio decoded
whole needs nothing. Read moreAuto Trait Implementations§
impl<D> !RefUnwindSafe for WindowedAudioSources<D>
impl<D> !Sync for WindowedAudioSources<D>
impl<D> !UnwindSafe for WindowedAudioSources<D>
impl<D> Forget for WindowedAudioSources<D>
impl<D> Freeze for WindowedAudioSources<D>where
*const dyn FnMut(&SourceId, Option<u32>) -> Result<D, AudioWindowError> + Send is !null: Freeze,
PhantomData<dyn FnMut(&SourceId, Option<u32>) -> Result<D, AudioWindowError> + Send>: Freeze,
*const u8 is !null: Freeze,
PhantomData<((SourceId, Option<u32>), Vec<WindowedAudioSource<D>>)>: Freeze,
impl<D> Move for WindowedAudioSources<D>
impl<D> Send for WindowedAudioSources<D>
impl<D> Unpin for WindowedAudioSources<D>
impl<D> UnsafeUnpin for WindowedAudioSources<D>where
*const dyn FnMut(&SourceId, Option<u32>) -> Result<D, AudioWindowError> + Send is !null: UnsafeUnpin,
PhantomData<dyn FnMut(&SourceId, Option<u32>) -> Result<D, AudioWindowError> + Send>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<((SourceId, Option<u32>), Vec<WindowedAudioSource<D>>)>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more