Skip to content

Commit

Permalink
Fix last clippy lints in core/midi module (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex authored Jan 1, 2024
1 parent 8680ced commit 8ba1ea1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/core/midi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,8 @@ pub(in super::super) fn cc(
/* FIXME: according to the Downloadable Sounds II specification,
bit 31 should be set when we receive the message on channel
10 (drum channel) */
channel.set_banknum(
(value as u32 & 0x7f).wrapping_add((channel.bank_msb() as u32) << 7 as i32),
);
channel
.set_banknum((value as u32 & 0x7f).wrapping_add((channel.bank_msb() as u32) << 7));
}

// ALL_NOTES_OFF
Expand All @@ -380,8 +379,7 @@ pub(in super::super) fn cc(

// DATA_ENTRY_MSB
6 => {
let data: i32 =
((value as i32) << 7 as i32) + channel.cc(DATA_ENTRY_LSB as usize) as i32;
let data: i32 = ((value as i32) << 7) + channel.cc(DATA_ENTRY_LSB as usize) as i32;

if channel.nrpn_active() != 0 {
let (nrpn_select, nrpn_msb, nrpn_lsb) = (
Expand Down Expand Up @@ -409,6 +407,7 @@ pub(in super::super) fn cc(
0 => pitch_wheel_sens(channel, voices, value),
// RPN_CHANNEL_FINE_TUNE
1 => {
// Fine tune is 14 bit over +/-1 semitone (+/- 100 cents, 8192 = center)
set_gen(
channel,
voices,
Expand All @@ -418,15 +417,21 @@ pub(in super::super) fn cc(
}
// RPN_CHANNEL_COARSE_TUNE
2 => {
// Coarse tune is 7 bit and in semitones (64 is center)
set_gen(
channel,
voices,
GeneratorType::CoarseTune,
(value - 64) as f32,
);
}
// TODO: This is fishy, for some reason those are missing from FluidLite, but
// are pressent in Fluidsynth
// https://github.com/FluidSynth/fluidsynth/blob/fa5173cbaefed60121db057bad7be7686165f7cc/src/synth/fluid_synth.c#L1857

// RPN_TUNING_PROGRAM_CHANGE | RPN_TUNING_BANK_SELECT | RPN_MODULATION_DEPTH_RANGE
3 | 4 | 5 | _ => {}
// 3 | 4 | 5 => {}
_ => {}
}
}
}
Expand Down

0 comments on commit 8ba1ea1

Please sign in to comment.