Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
    pub volumes: Volumes,
    /* private fields */
}
Expand description

The sound scene: up to 256 playing effects and 4,096 effects in the world, their emitters, and the volumes of the kinds of sound. Scene::update mixes them every frame.

Original: Audio::Scene.

Fields§

§volumes: Volumes

The volume of each kind of sound.

Implementations§

Source§

impl Scene

Source

pub fn play_effect(&mut self, effect: &Rc<Effect>, kind: u32, start: i64) -> u32

PlayEffect: the first free slot, starting start µs into the effect. Returns 0 when all 256 are busy.

Original: Runtime 0x1800e17b0.

Source

pub fn play_effect_3d( &mut self, effect: &Rc<Effect>, kind: u32, start: i64, at: Vec3, ) -> u32

PlayEffect3D with FindFree3DEffect: refused when the same effect already plays within its radius and started less than the retrigger window ago.

Original: Runtime 0x1800e1700.

Source

pub fn find_effect_3d(&self, effect: &Rc<Effect>) -> u32

FindEffect3D: the 3D effect playing this SoundEffect, or 0.

Source

pub fn add_emitter(&mut self, handle: u32, at: Vec3, volume: f32)

AddEmitter.

Source

pub fn remove_emitter(&mut self, handle: u32, at: Vec3)

RemoveEmitter: the first emitter at that position.

Source

pub fn move_emitter(&mut self, handle: u32, from: Vec3, to: Vec3)

MoveEmitter.

Source

pub fn set_emitter_volume(&mut self, handle: u32, at: Vec3, volume: f32)

SetEmitterVolume.

Source

pub fn emitter_count(&self, handle: u32) -> usize

GetEmitterCount.

Source

pub fn is_effect_playing(&self, handle: u32) -> bool

IsEffectPlaying.

Source

pub fn stop_effect(&mut self, mixer: &mut dyn Mixer, handle: u32)

StopEffect: stop its channels and free it.

Source

pub fn stop_effect_3d(&mut self, mixer: &mut dyn Mixer, handle: u32)

StopEffect3D.

Source

pub fn stop_all(&mut self, mixer: &mut dyn Mixer)

StopAll: every 2D effect (3D effects stay and restart when audible).

Source

pub fn pause(&mut self, mixer: &mut dyn Mixer, kind: u32, paused: bool)

Pause(type, paused).

Source

pub fn is_paused(&self, kind: u32) -> bool

IsPaused(type).

Source

pub fn on_ended(&mut self, channel: Channel)

The device’s end callback (OnSoundEnded): mark the sound ended.

Source

pub fn update( &mut self, mixer: &mut dyn Mixer, dt: i64, step: i64, rand: &mut dyn FnMut() -> u32, listener: Vec3, reach: f32, )

Update(dt, step, random, listener, reach). dt advances the effects; step is the simulation step of the frame; reach extends every 3D effect’s radius (the camera’s distance from its pivot).

Original: Runtime 0x1800e1f10.

Source

pub fn active(&self) -> (usize, usize)

Effects currently held (tests, debugging).

Trait Implementations§

Source§

impl Default for Scene

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Send for Scene

§

impl !Sync for Scene

§

impl Freeze for Scene

§

impl RefUnwindSafe for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

§

impl UnwindSafe for Scene

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
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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.