Skip to content

Commit d5b2df8

Browse files
author
Goran Mekić
committed
Fix MIDI notes
1 parent 993844e commit d5b2df8

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "maolan-widgets"
3-
version = "0.0.6"
3+
version = "0.0.7"
44
edition = "2024"
55
description = "Widgets used for Maolan DAW"
66
license = "BSD-2-Clause"

src/piano.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ where
272272
pub octave: u8,
273273
pub note_count: u8,
274274
pub midnam_note_names: HashMap<u8, String>,
275+
/// Cached names count for widget identity
275276
on_press: Press,
276277
on_release: Release,
277278
}
@@ -427,19 +428,14 @@ where
427428
bounds: Rectangle,
428429
_cursor: mouse::Cursor,
429430
) -> Vec<Geometry> {
430-
let is_piano = self.midnam_note_names.is_empty()
431-
|| self.midnam_note_names.values().all(|name| {
432-
matches!(
433-
name.as_str(),
434-
"C" | "C#" | "D" | "D#" | "E" | "F" | "F#" | "G" | "G#" | "A" | "A#" | "B"
435-
) || name.starts_with('C')
436-
|| name.starts_with('D')
437-
|| name.starts_with('E')
438-
|| name.starts_with('F')
439-
|| name.starts_with('G')
440-
|| name.starts_with('A')
441-
|| name.starts_with('B')
442-
});
431+
let is_piano = self.midnam_note_names.is_empty();
432+
eprintln!(
433+
"[piano] octave={} names_count={} is_piano={} sample_names={:?}",
434+
self.octave,
435+
self.midnam_note_names.len(),
436+
is_piano,
437+
self.midnam_note_names.iter().take(3).collect::<Vec<_>>()
438+
);
443439

444440
if is_piano {
445441
if self.note_count == NOTES_PER_OCTAVE as u8 {

0 commit comments

Comments
 (0)