Keyboard
File: Rhapsodist/Core/Widgets/Keyboard.js · Namespace: Keyboard.
Overview
Keyboard drives the on-screen keyboard’s key colours from Manifest.keyranges, the current patch/articulation’s own key ranges, and the current transposition, keeping colouring aligned with the notes that will actually trigger a range.
Usage
Keyboard wires itself to fltKeyboard and starts colouring keys as soon as Core.js includes it, reacting to patch, articulation, and transpose changes on its own.
Look and Feel
fltKeyboard draws through a local Look and Feel, deferring to the project’s own LookAndFeel function first if one is defined.
| Function | Draws |
|---|---|
drawWhiteNote | Each white key. |
drawBlackNote | Each black key. |
Public API
Thin wrappers over the fltKeyboard floating tile, usable by an expansion that needs to adjust keyboard display properties at runtime:
| Function | Description | Returns |
|---|---|---|
setProperty(key: string, value: NotUndefined) | Sets a fltKeyboard property directly. | — |
setDataProperty(key: string, value: NotUndefined) | Writes a key in fltKeyboard’s Data JSON. | — |
getDataProperty(key: string) | Reads a key from fltKeyboard’s Data JSON. | NotUndefined |
Internal Reference
| Function | Description | Returns |
|---|---|---|
updateVisibleRange() | Reads LowKey/HiKey from fltKeyboard’s Data into lowHiKey, used to round the low/high key’s outer corners. | — |
setKeyRanges() | Applies every stored key range’s colour (Manifest, patch, and articulation ranges, adjusted for the current transposition) via Engine.setKeyColour. | — |
resetKeyColours() | Resets every key to its inactive colour before setKeyRanges() re-applies the active ranges. | — |
Broadcasters
| Broadcaster | Description |
|---|---|
bcPatchChanged | knbPatch’s value changes. Applies the new patch’s keyranges, if any, and re-colours the keyboard. |
bcArticulationChanged | knbArticulation’s value changes. Applies the new articulation’s keyranges, if any, and re-colours the keyboard. |
bcTranposeChanged | knbTranspose’s value changes. Updates the stored transposition and re-colours the keyboard against it. |