Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add Left / Right hand information for pianos #172

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fa4c9c3
Update mod.rs
captainerd May 13, 2024
446e7dd
Adding a (Left/Right Hand) information card column
captainerd May 13, 2024
c3735a5
Utilizing the hand information in card + reverse iteration to display…
captainerd May 13, 2024
e6e6b8a
Fixes bug of jumping/ignoring non-pressed notes, adding accuracy to s…
captainerd May 14, 2024
96668c3
Merge branch 'PolyMeilex:master' into master
captainerd May 14, 2024
912f7b3
cargo fmt + hand_info non-piano column hide
captainerd May 14, 2024
8345978
Fix Percussion getting hand_info
captainerd May 14, 2024
ee83097
Merge branch 'PolyMeilex:master' into master
captainerd May 16, 2024
ca4317b
Gameplay accuracy+stats
captainerd May 16, 2024
06223cd
Added Game Stats screen, Added Folder select/song list, prepairing ic…
captainerd May 20, 2024
324d0ba
gamestats adjustments
captainerd May 21, 2024
def57e7
New screens UI Resposiveness+themeing
captainerd May 21, 2024
5379603
fmt
captainerd May 21, 2024
7673337
Scenes Refinements, track icons
captainerd May 22, 2024
1e9fddd
Refinements
captainerd May 22, 2024
2fe60a7
minor corrections
captainerd May 23, 2024
453d3d1
minor corrections
captainerd May 23, 2024
9198375
cargo fmt
captainerd May 23, 2024
18ba27c
After-test debugging
captainerd May 24, 2024
2379e39
After-tests debugging
captainerd May 24, 2024
8205bb4
Update neothesia/src/scene/playing_scene/midi_player.rs
captainerd May 24, 2024
09219e0
Refracted unessesary double-ended queues, removed unused enumerates
captainerd May 24, 2024
f9abb7a
Refract to Some(None) unsetted key up times, inclease a little the no…
captainerd May 25, 2024
bac6608
Clear leftovers from old 'wrong_notes -= x' there is no subtracting
captainerd May 25, 2024
bfe2b2a
After-tests debugging: correct the score shorting logic to match, ign…
captainerd May 26, 2024
ae0d444
After-tests debugging: correct the score shorting logic to match, ign…
captainerd May 26, 2024
ffd0ce0
Remove unnecessary if's and repeated code
captainerd May 26, 2024
307de70
Remove unnecessary if's and repeated code
captainerd May 26, 2024
520b0ed
mopping the floor
captainerd May 26, 2024
5ae11ff
case insensitive clean songname
captainerd May 26, 2024
4030a3a
Update README.md
captainerd Nov 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions neothesia-iced-widgets/src/track_card/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod theme;
pub struct TrackCard<'a, MSG> {
title: String,
subtitle: String,
hand_info: String,
body: Option<Element<'a, MSG>>,
track_color: Color,
on_icon_press: Option<MSG>,
Expand All @@ -22,6 +23,7 @@ impl<'a, MSG: 'a + Clone> TrackCard<'a, MSG> {
Self {
title: String::new(),
subtitle: String::new(),
hand_info: String::new(),
body: None,
track_color: Color::from_rgba8(210, 89, 222, 1.0),
on_icon_press: None,
Expand All @@ -33,6 +35,11 @@ impl<'a, MSG: 'a + Clone> TrackCard<'a, MSG> {
self
}

pub fn hand_info(mut self, text: impl ToString) -> Self {
self.hand_info = text.to_string();
self
}

pub fn subtitle(mut self, text: impl ToString) -> Self {
self.subtitle = text.to_string();
self
Expand Down Expand Up @@ -65,6 +72,7 @@ impl<'a, M: Clone + 'a> From<TrackCard<'a, M>> for Element<'a, M> {
.on_press_maybe(card.on_icon_press),
iced_widget::column(vec![
iced_widget::text(card.title).size(16).into(),
iced_widget::text(card.hand_info).size(16).into(),
iced_widget::text(card.subtitle).size(14).into(),
])
.spacing(4)
Expand Down
40 changes: 33 additions & 7 deletions neothesia/src/scene/menu_scene/iced_menu/tracks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ impl Page for TracksPage {
PageMessage::none()
}

fn view<'a>(_data: &'a Data, ctx: &Context) -> Element<'a, Event> {
fn view<'a>(_data: &'a Data, ctx: &Context) -> Element<'a, Event> {
PolyMeilex marked this conversation as resolved.
Show resolved Hide resolved
let mut tracks = Vec::new();
if let Some(song) = ctx.song.as_ref() {
for track in song.file.tracks.iter().filter(|t| !t.notes.is_empty()) {
let mut piano_count = 0;
for track in song
.file
.tracks
.iter()
.filter(|t| !t.notes.is_empty())
.rev()
{
let config = &song.config.tracks[track.track_id];

let visible = config.visible;
Expand All @@ -78,17 +85,35 @@ impl Page for TracksPage {
let color = &ctx.config.color_schema[color_id].base;
iced_core::Color::from_rgb8(color.0, color.1, color.2)
};
let instrument_id = track
.programs
.last()
.map(|p| p.program as usize)
.unwrap_or(0);

let name = if track.has_drums && !track.has_other_than_drums {
"Percussion"
} else {
let instrument_id = track
.programs
.last()
.map(|p| p.program as usize)
.unwrap_or(0);
midi_file::INSTRUMENT_NAMES[instrument_id]
};



PolyMeilex marked this conversation as resolved.
Show resolved Hide resolved
// Check if the instrument is Grand Piano (id 0, 1, or 2)
let hand_info = if instrument_id <= 2 {
PolyMeilex marked this conversation as resolved.
Show resolved Hide resolved
// Increment the piano counter
piano_count += 1;

PolyMeilex marked this conversation as resolved.
Show resolved Hide resolved
// Determine if it's the first or second occurrence of Grand Piano
if piano_count % 2 == 0 {
"Right Hand"
} else {
"Left Hand"
}
} else {
// For other instruments, no hand information
""
};

let body = neothesia_iced_widgets::SegmentButton::new()
.button(
Expand All @@ -110,6 +135,7 @@ impl Page for TracksPage {
.title(name)
.subtitle(format!("{} Notes", track.notes.len()))
.track_color(color)
.hand_info(hand_info) // Use hand_info field
.body(body);

let card = if track.has_drums && !track.has_other_than_drums {
Expand Down
Loading