Add piano octave hotkeys and escape-only exit
This commit is contained in:
@@ -87,7 +87,7 @@
|
||||
},
|
||||
{
|
||||
"keys": "Piano mode",
|
||||
"description": "When using a piano: 1-9 (and 0 for the 10th slot) changes instrument, ASDFGHJKL;' plays C major notes, WETYUOP] plays sharps, Enter/Escape exits"
|
||||
"description": "When using a piano: 1-9 (and 0 for the 10th slot) changes instrument, -/= changes octave, ASDFGHJKL;' plays C major notes, WETYUOP] plays sharps, Escape exits"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Maintainer-controlled web client version.
|
||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||
window.CHGRID_WEB_VERSION = "2026.02.22 R203";
|
||||
window.CHGRID_WEB_VERSION = "2026.02.22 R204";
|
||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||
|
||||
@@ -880,9 +880,10 @@ async function startPianoUseMode(itemId: string): Promise<void> {
|
||||
if (!item || item.type !== 'piano') return;
|
||||
activePianoItemId = itemId;
|
||||
activePianoKeys.clear();
|
||||
activePianoKeyMidi.clear();
|
||||
state.mode = 'pianoUse';
|
||||
await audio.ensureContext();
|
||||
updateStatus(`Piano mode: ${item.title}. Press Enter or Escape to stop.`);
|
||||
updateStatus(`using ${item.title}, press escape to stop.`);
|
||||
audio.sfxUiBlip();
|
||||
}
|
||||
|
||||
@@ -2313,7 +2314,7 @@ function handleMicGainEditModeInput(code: string, key: string, ctrlKey: boolean)
|
||||
|
||||
/** Handles realtime keyboard performance while piano item mode is active. */
|
||||
function handlePianoUseModeInput(code: string): void {
|
||||
if (code === 'Escape' || code === 'Enter') {
|
||||
if (code === 'Escape') {
|
||||
stopPianoUseMode(true);
|
||||
return;
|
||||
}
|
||||
@@ -2327,6 +2328,20 @@ function handlePianoUseModeInput(code: string): void {
|
||||
stopPianoUseMode(false);
|
||||
return;
|
||||
}
|
||||
if (code === 'Equal' || code === 'Minus') {
|
||||
const current = getPianoParams(item).octave;
|
||||
const next = Math.max(-2, Math.min(2, current + (code === 'Equal' ? 1 : -1)));
|
||||
item.params.octave = next;
|
||||
signaling.send({ type: 'item_update', itemId, params: { octave: next } });
|
||||
void previewPianoSettingChange(item, {});
|
||||
updateStatus(`octave ${next}.`);
|
||||
if (next === current) {
|
||||
audio.sfxUiCancel();
|
||||
} else {
|
||||
audio.sfxUiBlip();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (code.startsWith('Digit')) {
|
||||
const digit = Number(code.slice(5));
|
||||
const instrumentIndex = digit === 0 ? 9 : digit - 1;
|
||||
|
||||
Reference in New Issue
Block a user