P6a: mobile music surface (keyboard-primary instrument pane)
The mobile Piano Roll becomes a unified, keyboard-primary instrument surface (wireframe Plate 04/08): a playable keyboard as the base, revealing a Synthesia-style falling-notes roll above it when the pane is tall enough. - Shared keyboard geometry (panes/keyboard_layout.rs): width-driven, pan-aware pitch->x, so the roll's note columns stay aligned with the Virtual Piano keys. Shared keyboard_octave + keyboard_pan_x in SharedPaneState. - Piano Roll vertical mode (is_mobile): notes as columns falling toward an amber now-line by the keys, tempo-map converted (beats->seconds) so onsets cross the line exactly when they sound. Vertical drag scrubs the timeline; horizontal drag smoothly scrolls the keys (snaps to nearest key on release). Long-press creates a note (drag to size) or resizes an existing one; pan suppresses it. The keyboard is embedded (reuses Virtual Piano render + MIDI); the standalone VirtualPiano stack slot is removed. show_roll is driven by the snapped pane size-class so the keyboard<->roll reveal lands on a stack snap point. - Virtual Piano: renders via the shared layout on mobile, colors playback_notes like pressed keys, gates note-on/glissando to presses that start on the keys (never gating release), and hides QWERTY hints on mobile. - Transport formats by document.timeline_mode (Measures->bar.beat.tick, Frames->MM:SS:FF, Seconds->MM:SS.mmm) — per project type, like desktop. - In-pane instrument header (name + Presets + REC). Recording is driven from the app each frame (not the Timeline pane's render) so REC works regardless of visible panes, and stopping playback stops recording. - Compose/Record intent opens Timeline + instrument pane; mobile central panel is full-bleed (no inner margin) so panes sit flush. - phone-ui-sketches.html: inst-bar moved to the top of the music surface.
This commit is contained in:
@@ -89,21 +89,21 @@ pub enum StackPane {
|
||||
AssetLibrary,
|
||||
Stage,
|
||||
Timeline,
|
||||
/// The instrument surface: keyboard-primary on mobile, hosting the falling-notes roll above the
|
||||
/// keys (the standalone Virtual Piano is embedded here, so it isn't a separate stack slot).
|
||||
PianoRoll,
|
||||
VirtualPiano,
|
||||
/// Node editor, or (toggled) the instrument/preset browser.
|
||||
NodeInstrument,
|
||||
ScriptEditor,
|
||||
}
|
||||
|
||||
/// The stack order. Index into this is a pane's stable slot id.
|
||||
pub const STACK: [StackPane; 8] = [
|
||||
pub const STACK: [StackPane; 7] = [
|
||||
StackPane::Outliner,
|
||||
StackPane::AssetLibrary,
|
||||
StackPane::Stage,
|
||||
StackPane::Timeline,
|
||||
StackPane::PianoRoll,
|
||||
StackPane::VirtualPiano,
|
||||
StackPane::NodeInstrument,
|
||||
StackPane::ScriptEditor,
|
||||
];
|
||||
@@ -118,7 +118,6 @@ impl StackPane {
|
||||
StackPane::Stage => PaneType::Stage,
|
||||
StackPane::Timeline => PaneType::Timeline,
|
||||
StackPane::PianoRoll => PaneType::PianoRoll,
|
||||
StackPane::VirtualPiano => PaneType::VirtualPiano,
|
||||
StackPane::NodeInstrument => {
|
||||
if show_instruments {
|
||||
PaneType::PresetBrowser
|
||||
@@ -136,8 +135,7 @@ impl StackPane {
|
||||
StackPane::AssetLibrary => "Assets",
|
||||
StackPane::Stage => "Stage",
|
||||
StackPane::Timeline => "Timeline",
|
||||
StackPane::PianoRoll => "Piano Roll",
|
||||
StackPane::VirtualPiano => "Keys",
|
||||
StackPane::PianoRoll => "Instrument",
|
||||
StackPane::NodeInstrument => {
|
||||
if show_instruments {
|
||||
"Instruments"
|
||||
@@ -332,6 +330,20 @@ pub fn render_mobile_shell(
|
||||
region
|
||||
};
|
||||
|
||||
// Decide whether the instrument pane (PianoRoll = STACK index 4) reveals the roll, from the
|
||||
// *committed* (snapped) window weights — so the keyboard↔roll transition lands on a stack snap
|
||||
// rather than at an arbitrary mid-drag height. Roll shows once the pane is past the smallest snap.
|
||||
rc.shared.instrument_show_roll = {
|
||||
let idx = 4i32 - state.window_top as i32;
|
||||
if idx >= 0 && (idx as usize) < state.window_count {
|
||||
let sum: f32 = state.weights[..state.window_count].iter().map(|w| w.max(0.0)).sum();
|
||||
let w = if sum > 0.0 { state.weights[idx as usize].max(0.0) / sum } else { 0.0 };
|
||||
w > 0.30 // 0.25 preset ⇒ keyboard only; 0.33/0.5/0.75 ⇒ keyboard + roll
|
||||
} else {
|
||||
true
|
||||
}
|
||||
};
|
||||
|
||||
stack::render(ui, stack_rect, rc, state, &pal);
|
||||
|
||||
if inspector_shown {
|
||||
@@ -345,6 +357,16 @@ pub fn render_mobile_shell(
|
||||
// Omnibutton FAB (radial tool menu) — drawn above the stack region, on top of everything else.
|
||||
omni::render(ui, region, rc, state, &pal);
|
||||
|
||||
// Instrument-browser request from the music pane's header → show the Preset Browser fullscreen.
|
||||
if *rc.shared.open_instrument_browser {
|
||||
*rc.shared.open_instrument_browser = false;
|
||||
state.show_instruments = true;
|
||||
state.window_top = 5; // Node/Instrument band (PresetBrowser when show_instruments)
|
||||
state.window_count = 1;
|
||||
state.weights = [1.0, 1.0, 1.0];
|
||||
state.anim = None;
|
||||
}
|
||||
|
||||
// Top bar (filename + ⌕ palette + ⋯ commands). Its menus overlay the whole shell, so it's last.
|
||||
topbar::render(ui, topbar_rect, available_rect, rc, state, &pal);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user