Struct CueBatch

Source
pub struct CueBatch<'a, const N: usize> { /* private fields */ }
Expand description

Exclusive, thread-bound, one-frame accumulator. No implicit flush on drop. See the module recipe for fixed updates, terminal feedback and lifecycle.

ⓘ
use ferravex_render::audio::{GameAudio, batch::CueBatch};
let mut owner = GameAudio::new();
let mut frame = CueBatch::<5>::new(&mut owner).unwrap();
owner.reset(); // Pending work prevents direct lifecycle/owner replacement.
frame.flush();
ⓘ
use ferravex_render::audio::{GameAudio, batch::CueBatch};
let mut owner = GameAudio::new();
let frame = CueBatch::<5>::new(&mut owner).unwrap();
std::thread::scope(|scope| { scope.spawn(move || drop(frame)); });

Implementations§

Source§

impl<'a, const N: usize> CueBatch<'a, N>

Source

pub fn new(owner: &'a mut GameAudio) -> Result<CueBatch<'a, N>, BatchError>

Borrow a controller for one presentation frame. Does not initialize or replace the mixer; normally GameAudio construction has prepared its bank. Rejects capacities outside 1..=128. See the module recipe.

Source

pub fn len(&self) -> usize

Pending slots (may include runtime-stale requests until reconciliation).

Source

pub fn is_empty(&self) -> bool

Whether no slots are pending. See Self::len.

Source

pub fn counts(&self) -> BatchCounts

Copy counters without resetting or reconciling the runtime.

Source

pub fn queue( &mut self, category: CueCategory, position: Option<Vec3>, gain: f32, ) -> Result<QueueOutcome, BatchError>

Collect only a caller-accepted event. Validation precedes any mutation. Raw gains are not clamped; GameAudio also validates its resulting acoustic gain at flush. Distinct positions never coalesce. See the module recipe. Paused collection is permitted, but flush uses GameAudio’s real suppression (nonpositional Click bypasses pause). No resume API exists on the batch: release it before resuming, so paused work cannot cross that boundary.

Source

pub fn cancel(&mut self) -> usize

Discard pending cues without touching any controller’s voices/settings. Returns discarded slots; records cancelled. See the module recipe.

Source

pub fn pause(&mut self) -> usize

Cancel all pending cues, then pause this owner. Already-playing UI clicks and other owners’ voices retain GameAudio semantics. See the module recipe.

Source

pub fn reset(&mut self) -> usize

Cancel all pending cues, then reset this owner, preserving its pause and acoustics. Call alongside game/session restart. See the module recipe.

Source

pub fn flush(&mut self) -> FlushReport<N>

Consume retained requests once, in retained order, calling exactly cue_with_outcome for None positions and at_with_outcome otherwise. Clears frame counters after reporting, including on an empty flush. Runtime-stale slots are discarded before any submission. Rejected or paused requests are not queued for retry. See the module recipe.

Auto Trait Implementations§

§

impl<'a, const N: usize> Freeze for CueBatch<'a, N>

§

impl<'a, const N: usize> !RefUnwindSafe for CueBatch<'a, N>

§

impl<'a, const N: usize> !Send for CueBatch<'a, N>

§

impl<'a, const N: usize> !Sync for CueBatch<'a, N>

§

impl<'a, const N: usize> Unpin for CueBatch<'a, N>

§

impl<'a, const N: usize> !UnwindSafe for CueBatch<'a, N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.