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>
impl<'a, const N: usize> CueBatch<'a, N>
Sourcepub fn new(owner: &'a mut GameAudio) -> Result<CueBatch<'a, N>, BatchError>
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.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Pending slots (may include runtime-stale requests until reconciliation).
Sourcepub fn counts(&self) -> BatchCounts
pub fn counts(&self) -> BatchCounts
Copy counters without resetting or reconciling the runtime.
Sourcepub fn queue(
&mut self,
category: CueCategory,
position: Option<Vec3>,
gain: f32,
) -> Result<QueueOutcome, BatchError>
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.
Sourcepub fn cancel(&mut self) -> usize
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.
Sourcepub fn pause(&mut self) -> usize
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.
Sourcepub fn reset(&mut self) -> usize
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.
Sourcepub fn flush(&mut self) -> FlushReport<N>
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.