Skip to content

Commit 5e339c2

Browse files
committed
always play click sound for first empty bar, and always play guitar sound when seeking
1 parent 2bdd330 commit 5e339c2

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

crates/notation_bevy/src/viewer/control_view.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ impl ControlView {
200200
});
201201
if ui.button("Reset Audio").clicked() {
202202
let default = MidiSettings::default();
203+
midi_settings.click_mute = default.click_mute;
204+
midi_settings.click_velocity = default.click_velocity;
203205
midi_settings.vocal_mute = default.vocal_mute;
204206
midi_settings.vocal_velocity = default.vocal_velocity;
205207
midi_settings.guitar_mute = default.guitar_mute;

crates/notation_midi/src/midi_settings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ impl Default for MidiSettings {
3030
fn default() -> Self {
3131
Self {
3232
bypass_hub: false,
33-
click_mute: false,
34-
click_velocity: 50,
33+
click_mute: true,
34+
click_velocity: 100,
3535
click_octave: Octave::P7,
3636
vocal_mute: false,
3737
vocal_velocity: 110,

crates/notation_midi/src/midi_state.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,23 @@ impl MidiChannel {
108108
if !bypass {
109109
match &self.track {
110110
Some(track) => {
111-
if !is_seeking || track.kind != settings.seeking_track {
112-
match track.kind {
113-
TrackKind::Vocal => {
114-
velocity = if settings.vocal_mute { 0 } else { settings.vocal_velocity };
115-
},
116-
TrackKind::Guitar => {
117-
velocity = if settings.guitar_mute { 0 } else { settings.guitar_velocity };
118-
},
119-
TrackKind::Piano => {
120-
velocity = if settings.piano_mute { 0 } else { settings.piano_velocity };
121-
},
122-
_ => (),
123-
}
111+
let seeking = is_seeking && track.kind == settings.seeking_track;
112+
match track.kind {
113+
TrackKind::Vocal => {
114+
velocity = if !seeking && settings.vocal_mute { 0 } else { settings.vocal_velocity };
115+
},
116+
TrackKind::Guitar => {
117+
velocity = if !seeking && settings.guitar_mute { 0 } else { settings.guitar_velocity };
118+
},
119+
TrackKind::Piano => {
120+
velocity = if !seeking && settings.piano_mute { 0 } else { settings.piano_velocity };
121+
},
122+
_ => (),
124123
}
125124
},
126125
None => {
127-
velocity = if settings.click_mute { 0 } else { settings.click_velocity };
126+
let is_rest = play_control.position.bar.bar_ordinal == 0;
127+
velocity = if !is_rest && settings.click_mute { 0 } else { settings.click_velocity };
128128
}
129129
}
130130
}

0 commit comments

Comments
 (0)