Skip to main content

EventBank

Struct EventBank 

Source
pub struct EventBank { /* private fields */ }
Expand description

Parsed text bank, independent of a mixer or source registry.

Implementations§

Source§

impl EventBank

Source

pub fn parse(text: &str) -> Result<Self, ParseError>

Parses UTF-8 text (at most 1 MiB, 1024 events, 64 source entries per event). Blank/comment lines are allowed; an empty bank is valid. Every other line is event NAME sources=A,B [key=value ...]. No whitespace inside values. Identifiers contain 1..=64 ASCII letters/digits/_/-/.. Unknown/repeated keys and duplicate event names are errors.

KeyValues / default
sourcesRequired comma-separated registered names; duplicates weight entries
choicerandom (default), shuffle, sequence
gainLinear min,max or fixed value, finite >=0; default 1
pitchSemitones min,max or fixed, -48..=48; default 0
busNamed mixer bus or master (default)
priority0..=255; default 128
max-instancesConcurrent voices across all variants; 0 unlimited (default)
min-gapMinimum seconds between admitted starts, 0..=60; default 0
policyrefuse (default), oldest, quietest
loopoff (default), whole, or start,end source frames
pan-1..=1, default 0; replaced by spatial placement
rate1/16..=8; default 1
fade-inLinear fade seconds, 0..=60; default 0
positionx,y relative 2D position using the mixer’s Space2d
emitterx,y,z world position, mutually exclusive with position
velocityx,y,z (default zero), requires emitter
attenuationmodel,min,max,rolloff; model is linear, inverse or exponential; requires emitter; mixer defaults

Sequence wraps in text order. Shuffle draws every entry once per cycle and avoids the previous entry at cycle boundaries when there are >=2 entries. Random samples with replacement. Distinct entries may name the same sound.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn names(&self) -> impl Iterator<Item = &str>

Event names in definition order.

Source

pub fn prepare( &self, handle: &MixerHandle, sources: &Sources, ) -> Result<PreparedBank, ParseError>

Resolves all references and validates loop regions against every candidate. Resolution errors retain the line/column of the corresponding text token. Preparing again creates independent instance groups; clone the resulting bank or create multiple players from it to share limits.

Trait Implementations§

Source§

impl Clone for EventBank

Source§

fn clone(&self) -> EventBank

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.