chore: add pitch bend message
Status
To test, the TouchDAW demo application in workshop mode is used to send MIDI messages via usb-midi.
There are few problems with the onBend and wildcard (investigating issue) and the PR lacks documentation examples
Description
This pull request adds support for MIDI pitch bend events to the Hydra MIDI API. The main changes include introducing new state management for pitch bend values and events, exposing pitch bend utilities and event handlers throughout the API, and updating transforms to allow easy access to pitch bend data. These updates make it possible to read and react to pitch bend messages in a way consistent with other MIDI controls in the system.
Pitch Bend Support
- Added
bendand_bendfunctions insrc/hydra-api/bend.tsto retrieve and chain pitch bend values, along with a utility to generate a pitch bend ID. - Introduced
onBendevent handler insrc/hydra-api/onBend.tsfor registering callbacks on pitch bend events. - Updated exports in
src/hydra-api/index.tsto include pitch bend utilities and event handlers.
State Management
- Added
bendValuesandbendEventsmaps tosrc/state.tsto store pitch bend values and event handlers, including session storage persistence and monkey-patching for auto-save. [1] [2] [3] - Modified
src/midiAccess.tsto handle incoming pitch bend messages, normalize values, update state, and trigger registered event handlers. [1] [2]
Transforms and API Exposure
- Updated
channelandinputtransforms to providebendandonBendmethods for accessing pitch bend data and registering event handlers per channel/input. [1] [2] [3] [4] [5] [6] [7] - Exposed
bendand_bendfunctions in the global window object for use in scripts. [1] [2]
Type Definitions
- Added
BendIdtype andBendEventContextinterface tosrc/types.tsfor strong typing of pitch bend IDs and event contexts. [1] [2]