}
Ok(())
}
fn fun_name(
&mut self,
register: u8,
port: u8,
data: u8,
fsam_2612: f64,
midi: &mut MIDIShim<'_, '_>,
) -> Result<(), anyhow::Error> {
let channel = (register ^ 0xA0) + port;
if self.config.ym2612_ch_disabled[channel as usize] {
return Ok(());
}
self.state.factored.fnum_lsb[channel as usize] = data;
self.state.factored.fnum_1[channel as usize] =
self.state.factored.fnum_2[channel as usize];
self.state.factored.fnum_2[channel as usize] =
((self.state.factored.fnum_msb[channel as usize] as u32) << 8)
+ self.state.factored.fnum_lsb[channel as usize] as u32;
self.state.factored.hz_1[channel as usize] = shift(
&mut self.state.factored.hz_2[channel as usize],
hz_ym2612(
self.state.factored.fnum_2[channel as usize],
Some(self.state.block[channel as usize]),
fsam_2612,
),
);
self.state.factored.note_1[channel as usize] = shift(
&mut self.state.factored.note_2[channel as usize],
hz_to_note(self.state.factored.hz_2[channel as usize]),
);
if self.state.factored.note_on_2[channel as usize]
&& self.state.factored.note_1[channel as usize]
!= self.state.factored.note_2[channel as usize]
{
midi.do_note_on(
self.state.factored.note_1[channel as usize],
self.state.factored.note_2[channel as usize],
channel.into(),
&mut self.state.factored.midi_note[channel as usize],
&mut self.state.factored.midi_wheel[channel as usize],
None,
None,
)?;