pub trait Hw {
// Required methods
fn configure(
&mut self,
voice: u8,
sample: &Sample,
looped: bool,
pitch_q12: u16,
);
fn set_volume(&mut self, voice: u8, left: i16, right: i16);
fn set_pitch(&mut self, voice: u8, pitch_q12: u16);
fn key_on(&mut self, mask: u32);
fn key_off(&mut self, mask: u32);
}Expand description
What the mixer needs from a sound chip.
Voice numbers are 0..24. Masks have bit n set for voice n.
§Example
use psx_sfx::hw::{Hw, NullHw};
let mut hw = NullHw;
hw.key_off(0b101); // accepted and ignoredRequired Methods§
Sourcefn configure(
&mut self,
voice: u8,
sample: &Sample,
looped: bool,
pitch_q12: u16,
)
fn configure( &mut self, voice: u8, sample: &Sample, looped: bool, pitch_q12: u16, )
Point voice at sample without starting it. looped selects the
hardware-loop setup; a one-shot also gets its repeat address written so
it parks on silence. pitch_q12 is a multiplier of the cooked rate
(4096 plays it as recorded).
Sourcefn set_volume(&mut self, voice: u8, left: i16, right: i16)
fn set_volume(&mut self, voice: u8, left: i16, right: i16)
Write a voice’s left and right volume (signed SPU levels, already scaled by the master volume).