✨ The equalizer card holds 20 bands like the MCP eq op; shift+digit picks bands 11-20
Browse files at this commitba1e3707fce24e67da9a5cbf8e57cb2f753fc591Parent: 2ced44a4 changed files +14 -17
- crates/app/src/audio_cards.rs +3 -6
- crates/app/src/player/cards.rs +8 -6
- crates/app/src/tests/cards.rs +2 -4
- crates/app/src/ui/cards/eq.rs +1 -1
crates/app/src/audio_cards.rsmodified+3 -6
| @@ -290,12 +290,9 @@ pub(crate) const EQ_W_MAX: f32 = 720.; | |||
| 290 | /// rather than as a second window: it takes the width it can get inside that. | 290 | /// rather than as a second window: it takes the width it can get inside that. |
| 291 | pub(crate) const EQ_W_MARGIN: f32 = 32.; | 291 | pub(crate) const EQ_W_MARGIN: f32 = 32.; |
| 292 | 292 | ||
| 293 | -/// How many bands one clip's equalizer may carry from this card. Ten because | 293 | +/// How many bands one clip's equalizer may carry from this card: a digit picks |
| 294 | -/// the keyboard picks a band with a digit and a keyboard has ten of them -- | 294 | +/// bands 1-10 and shift+digit 11-20, the same cap as the MCP `eq` op. |
| 295 | -/// past that a band would be reachable by pointer only. The engine itself caps | 295 | +pub(crate) const EQ_BANDS_MAX: usize = 20; |
| 296 | -/// nothing (`EqParams::bands` is a plain `Vec`), so a file may still carry more | ||
| 297 | -/// and this card will draw and edit every one it finds. | ||
| 298 | -pub(crate) const EQ_BANDS_MAX: usize = 10; | ||
| 299 | 296 | ||
| 300 | /// One press of the frequency keys, as a factor: a sixth of an octave, so a | 297 | /// One press of the frequency keys, as a factor: a sixth of an octave, so a |
| 301 | /// band walks the whole axis in about sixty presses and still lands close | 298 | /// band walks the whole axis in about sixty presses and still lands close |
crates/app/src/player/cards.rsmodified+8 -6
| @@ -4059,14 +4059,16 @@ impl Player { | |||
| 4059 | // the card *shows*, so it survives no further than this | 4059 | // the card *shows*, so it survives no further than this |
| 4060 | // window. | 4060 | // window. |
| 4061 | self.eq_spectrum = !self.eq_spectrum; | 4061 | self.eq_spectrum = !self.eq_spectrum; |
| 4062 | - } else if let Ok(digit) = key.parse::<usize>() { | 4062 | + } else if let Some((digit, shifted)) = key |
| 4063 | - // As the keys are laid out: 1-9 then 0 for the tenth, which | 4063 | + .parse::<usize>() |
| 4064 | - // is the cap ([`EQ_BANDS_MAX`]). A digit past the last band | 4064 | + .ok() |
| 4065 | - // picks nothing rather than panics. | 4065 | + .map(|d| (d, shift)) |
| 4066 | + .or_else(|| ")!@#$%^&*(".find(key).filter(|_| key.len() == 1).map(|d| (d, true))) | ||
| 4067 | + { | ||
| 4066 | let band = match digit { | 4068 | let band = match digit { |
| 4067 | - 0 => EQ_BANDS_MAX - 1, | 4069 | + 0 => 9, |
| 4068 | n => n - 1, | 4070 | n => n - 1, |
| 4069 | - }; | 4071 | + } + if shifted { 10 } else { 0 }; |
| 4070 | if band < self.eq_params.bands.len() { | 4072 | if band < self.eq_params.bands.len() { |
| 4071 | self.eq_band = band; | 4073 | self.eq_band = band; |
| 4072 | } | 4074 | } |
crates/app/src/tests/cards.rsmodified+2 -4
| @@ -679,12 +679,10 @@ fn a_band_can_be_moved_added_and_reached() { | |||
| 679 | "landed at {between:?}, not between 100 and 4000" | 679 | "landed at {between:?}, not between 100 and 4000" |
| 680 | ); | 680 | ); |
| 681 | 681 | ||
| 682 | - // Every band the card will hold is one digit away: the keyboard has ten | ||
| 683 | - // digits, which is exactly why the cap is what it is. | ||
| 684 | const { | 682 | const { |
| 685 | assert!( | 683 | assert!( |
| 686 | - EQ_BANDS_MAX <= 10, | 684 | + EQ_BANDS_MAX <= 20, |
| 687 | - "a band past the tenth has no key that picks it" | 685 | + "a band past the twentieth has no key that picks it" |
| 688 | ); | 686 | ); |
| 689 | } | 687 | } |
| 690 | assert!(EQ_BANDS_MAX > EqParams::default_layout().bands.len()); | 688 | assert!(EQ_BANDS_MAX > EqParams::default_layout().bands.len()); |
crates/app/src/ui/cards/eq.rsmodified+1 -1
| @@ -307,7 +307,7 @@ impl Player { | |||
| 307 | d.child(dark_card_head_reset( | 307 | d.child(dark_card_head_reset( |
| 308 | "Equalizer", | 308 | "Equalizer", |
| 309 | Some(format!("{} clip {}", lane.label(), idx + 1).into()), | 309 | Some(format!("{} clip {}", lane.label(), idx + 1).into()), |
| 310 | - Some("drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum, m fills the room".into()), | 310 | + Some("drag a handle, or a digit picks a band (shift+digit 11–20) — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum, m fills the room".into()), |
| 311 | Some(self.card_maximized), | 311 | Some(self.card_maximized), |
| 312 | Some(reset_eq_layout), | 312 | Some(reset_eq_layout), |
| 313 | cx, | 313 | cx, |