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: VolumesThe volume of each kind of sound.
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn play_effect(&mut self, effect: &Rc<Effect>, kind: u32, start: i64) -> u32
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.
Sourcepub fn play_effect_3d(
&mut self,
effect: &Rc<Effect>,
kind: u32,
start: i64,
at: Vec3,
) -> u32
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.
Sourcepub fn find_effect_3d(&self, effect: &Rc<Effect>) -> u32
pub fn find_effect_3d(&self, effect: &Rc<Effect>) -> u32
FindEffect3D: the 3D effect playing this SoundEffect, or 0.
Sourcepub fn add_emitter(&mut self, handle: u32, at: Vec3, volume: f32)
pub fn add_emitter(&mut self, handle: u32, at: Vec3, volume: f32)
AddEmitter.
Sourcepub fn remove_emitter(&mut self, handle: u32, at: Vec3)
pub fn remove_emitter(&mut self, handle: u32, at: Vec3)
RemoveEmitter: the first emitter at that position.
Sourcepub fn move_emitter(&mut self, handle: u32, from: Vec3, to: Vec3)
pub fn move_emitter(&mut self, handle: u32, from: Vec3, to: Vec3)
MoveEmitter.
Sourcepub fn set_emitter_volume(&mut self, handle: u32, at: Vec3, volume: f32)
pub fn set_emitter_volume(&mut self, handle: u32, at: Vec3, volume: f32)
SetEmitterVolume.
Sourcepub fn emitter_count(&self, handle: u32) -> usize
pub fn emitter_count(&self, handle: u32) -> usize
GetEmitterCount.
Sourcepub fn is_effect_playing(&self, handle: u32) -> bool
pub fn is_effect_playing(&self, handle: u32) -> bool
IsEffectPlaying.
Sourcepub fn stop_effect(&mut self, mixer: &mut dyn Mixer, handle: u32)
pub fn stop_effect(&mut self, mixer: &mut dyn Mixer, handle: u32)
StopEffect: stop its channels and free it.
Sourcepub fn stop_effect_3d(&mut self, mixer: &mut dyn Mixer, handle: u32)
pub fn stop_effect_3d(&mut self, mixer: &mut dyn Mixer, handle: u32)
StopEffect3D.
Sourcepub fn stop_all(&mut self, mixer: &mut dyn Mixer)
pub fn stop_all(&mut self, mixer: &mut dyn Mixer)
StopAll: every 2D effect (3D effects stay and restart when audible).
Sourcepub fn on_ended(&mut self, channel: Channel)
pub fn on_ended(&mut self, channel: Channel)
The device’s end callback (OnSoundEnded): mark the sound ended.
Sourcepub fn update(
&mut self,
mixer: &mut dyn Mixer,
dt: i64,
step: i64,
rand: &mut dyn FnMut() -> u32,
listener: Vec3,
reach: f32,
)
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.