Move piano recording keys to Z/X/C and keep control errors out of chat

This commit is contained in:
Jage9
2026-02-23 00:57:18 -05:00
parent 9477beb345
commit d8b470d389
5 changed files with 23 additions and 12 deletions

View File

@@ -87,7 +87,7 @@
}, },
{ {
"keys": "Piano mode", "keys": "Piano mode",
"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, comma starts/stops recording, period plays recording, slash stops playback, 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, Z starts/stops recording, X plays recording, C stops playback, Escape exits"
} }
] ]
}, },

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version. // Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
window.CHGRID_WEB_VERSION = "2026.02.22 R206"; window.CHGRID_WEB_VERSION = "2026.02.22 R207";
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit"; window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -2414,17 +2414,17 @@ function handlePianoUseModeInput(code: string): void {
stopPianoUseMode(false); stopPianoUseMode(false);
return; return;
} }
if (code === 'Comma') { if (code === 'KeyZ') {
signaling.send({ type: 'item_piano_recording', itemId, action: 'toggle_record' }); signaling.send({ type: 'item_piano_recording', itemId, action: 'toggle_record' });
audio.sfxUiBlip(); audio.sfxUiBlip();
return; return;
} }
if (code === 'Period') { if (code === 'KeyX') {
signaling.send({ type: 'item_piano_recording', itemId, action: 'playback' }); signaling.send({ type: 'item_piano_recording', itemId, action: 'playback' });
audio.sfxUiBlip(); audio.sfxUiBlip();
return; return;
} }
if (code === 'Slash') { if (code === 'KeyC') {
signaling.send({ type: 'item_piano_recording', itemId, action: 'stop_playback' }); signaling.send({ type: 'item_piano_recording', itemId, action: 'stop_playback' });
audio.sfxUiBlip(); audio.sfxUiBlip();
return; return;

View File

@@ -241,12 +241,18 @@ export function createOnMessageHandler(deps: MessageHandlerDeps): (message: Inco
} }
case 'item_action_result': { case 'item_action_result': {
const pianoStatusMessages = new Set([
'record',
'play',
'stop',
'No recording saved on this piano.',
'Stop recording before playback.',
'This piano is already recording.',
]);
if (message.ok) { if (message.ok) {
if (message.action === 'use') { if (message.action === 'use') {
const pianoStatusLabel = if (pianoStatusMessages.has(message.message)) {
message.message === 'record' || message.message === 'play' || message.message === 'stop' ? message.message : null; deps.updateStatus(message.message);
if (pianoStatusLabel) {
deps.updateStatus(pianoStatusLabel);
deps.audioUiBlip(); deps.audioUiBlip();
break; break;
} }
@@ -260,6 +266,11 @@ export function createOnMessageHandler(deps: MessageHandlerDeps): (message: Inco
deps.audioUiConfirm(); deps.audioUiConfirm();
} }
} else { } else {
if (message.action === 'use' && pianoStatusMessages.has(message.message)) {
deps.updateStatus(message.message);
deps.audioUiCancel();
break;
}
deps.pushChatMessage(message.message); deps.pushChatMessage(message.message);
deps.audioUiCancel(); deps.audioUiCancel();
} }

View File

@@ -81,9 +81,9 @@ Applies to effect select, user/item list modes, item selection, item property li
- `W E T Y U O P ]`: Play sharps - `W E T Y U O P ]`: Play sharps
- Multiple keys can be held/played at once - Multiple keys can be held/played at once
- `-` / `=`: Shift octave down/up - `-` / `=`: Shift octave down/up
- `,`: Start/stop recording on this piano (max 30s) - `Z`: Start/stop recording on this piano (max 30s)
- `.`: Play back saved recording on this piano - `X`: Play back saved recording on this piano
- `/`: Stop playback on this piano - `C`: Stop playback on this piano
- `Escape`: Exit piano mode - `Escape`: Exit piano mode
## Help Viewer Mode ## Help Viewer Mode