pub struct Sound { /* private fields */ }Expand description
A sample together with how the mixer should treat it.
Within a class a smaller prio is more important, matching WipEout’s signed
priority and Quake’s channel order.
§Example
use psx_sfx::mixer::*;
use psx_sfx::Sample;
use psx_spu::SpuAddr;
let s = Sample::resident(SpuAddr::new(0x1010), 22050, 40);
let horn = Sound::one_shot(SoundId(9), s, 1).with_class(Class::Protected).with_volume(0x3000);
assert_eq!(horn.class(), Class::Protected);
assert!(!horn.is_looped());Implementations§
Source§impl Sound
impl Sound
Sourcepub const fn one_shot(id: SoundId, sample: Sample, lane: u8) -> Self
pub const fn one_shot(id: SoundId, sample: Sample, lane: u8) -> Self
A sample that plays once and ends, on lane lane.
Sourcepub const fn looped(id: SoundId, sample: Sample, lane: u8) -> Self
pub const fn looped(id: SoundId, sample: Sample, lane: u8) -> Self
A sample whose cooked blocks form a hardware loop, on lane lane. It
plays until stopped.
Sourcepub const fn with_class(self, class: Class) -> Self
pub const fn with_class(self, class: Class) -> Self
Set the importance class.
Sourcepub const fn with_prio(self, prio: i16) -> Self
pub const fn with_prio(self, prio: i16) -> Self
Set the priority within the class; smaller is more important.
Sourcepub const fn with_volume(self, volume: i16) -> Self
pub const fn with_volume(self, volume: i16) -> Self
Set the default per-ear level used by Play::for_sound.
Sourcepub const fn with_pitch(self, pitch_q12: u16) -> Self
pub const fn with_pitch(self, pitch_q12: u16) -> Self
Set the default pitch multiplier (4096 = as cooked).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sound
impl RefUnwindSafe for Sound
impl Send for Sound
impl Sync for Sound
impl Unpin for Sound
impl UnsafeUnpin for Sound
impl UnwindSafe for Sound
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)