Skip to content

Commit

Permalink
Update control change message infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Philippe Côté committed Jan 18, 2023
1 parent 9ee04f8 commit ba31c03
Show file tree
Hide file tree
Showing 15 changed files with 3,440 additions and 663 deletions.
1,148 changes: 1,003 additions & 145 deletions src/Enumerations.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/Forwarder.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class Forwarder {
* types (`"noteon"`, `"controlchange"`, etc.), that the specified message must match in order to
* be forwarded. If this option is not specified, all types of messages will be forwarded. Valid
* messages are the ones found in either
* [`MIDI_SYSTEM_MESSAGES`](Enumerations#MIDI_SYSTEM_MESSAGES)
* or [`MIDI_CHANNEL_MESSAGES`](Enumerations#MIDI_CHANNEL_MESSAGES).
* [`SYSTEM_MESSAGES`](Enumerations#SYSTEM_MESSAGES)
* or [`CHANNEL_MESSAGES`](Enumerations#CHANNEL_MESSAGES).
* @param {number|number[]} [options.channels=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]]
* A MIDI channel number or an array of channel numbers that the message must match in order to be
* forwarded. By default all MIDI channels are included (`1` to `16`).
Expand All @@ -46,13 +46,13 @@ export class Forwarder {
/**
* An array of message types (`"noteon"`, `"controlchange"`, etc.) that must be matched in order
* for messages to be forwarded. By default, this array includes all
* [`Enumerations.MIDI_SYSTEM_MESSAGES`](Enumerations#MIDI_SYSTEM_MESSAGES) and
* [`Enumerations.MIDI_CHANNEL_MESSAGES`](Enumerations#MIDI_CHANNEL_MESSAGES).
* [`Enumerations.SYSTEM_MESSAGES`](Enumerations#SYSTEM_MESSAGES) and
* [`Enumerations.CHANNEL_MESSAGES`](Enumerations#CHANNEL_MESSAGES).
* @type {string[]}
*/
this.types = [
...Object.keys(Enumerations.MIDI_SYSTEM_MESSAGES),
...Object.keys(Enumerations.MIDI_CHANNEL_MESSAGES)
...Object.keys(Enumerations.SYSTEM_MESSAGES),
...Object.keys(Enumerations.CHANNEL_MESSAGES)
];

/**
Expand Down Expand Up @@ -87,8 +87,8 @@ export class Forwarder {

options.types.forEach(type => {
if (
! Enumerations.MIDI_SYSTEM_MESSAGES.hasOwnProperty(type) &&
! Enumerations.MIDI_CHANNEL_MESSAGES.hasOwnProperty(type)
! Enumerations.SYSTEM_MESSAGES.hasOwnProperty(type) &&
! Enumerations.CHANNEL_MESSAGES.hasOwnProperty(type)
) {
throw new TypeError("Type must be a valid message type.");
}
Expand Down
20 changes: 10 additions & 10 deletions src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,16 @@ export class Input extends EventEmitter {
* * [`nrpn`]{@link InputChannel#event:nrpn}
* * [`nrpn-dataentrycoarse`]{@link InputChannel#event:nrpn-dataentrycoarse}
* * [`nrpn-dataentryfine`]{@link InputChannel#event:nrpn-dataentryfine}
* * [`nrpn-databuttonincrement`]{@link InputChannel#event:nrpn-databuttonincrement}
* * [`nrpn-databuttondecrement`]{@link InputChannel#event:nrpn-databuttondecrement}
* * [`nrpn-dataincrement`]{@link InputChannel#event:nrpn-dataincrement}
* * [`nrpn-datadecrement`]{@link InputChannel#event:nrpn-datadecrement}
*
* 8. **RPN** Events (channel-specific)
*
* * [`rpn`]{@link InputChannel#event:rpn}
* * [`rpn-dataentrycoarse`]{@link InputChannel#event:rpn-dataentrycoarse}
* * [`rpn-dataentryfine`]{@link InputChannel#event:rpn-dataentryfine}
* * [`rpn-databuttonincrement`]{@link InputChannel#event:rpn-databuttonincrement}
* * [`rpn-databuttondecrement`]{@link InputChannel#event:rpn-databuttondecrement}
* * [`rpn-dataincrement`]{@link InputChannel#event:rpn-dataincrement}
* * [`rpn-datadecrement`]{@link InputChannel#event:rpn-datadecrement}
*
* @param event {string | EventEmitter.ANY_EVENT} The type of the event.
*
Expand Down Expand Up @@ -611,16 +611,16 @@ export class Input extends EventEmitter {
* * [`nrpn`]{@link InputChannel#event:nrpn}
* * [`nrpn-dataentrycoarse`]{@link InputChannel#event:nrpn-dataentrycoarse}
* * [`nrpn-dataentryfine`]{@link InputChannel#event:nrpn-dataentryfine}
* * [`nrpn-databuttonincrement`]{@link InputChannel#event:nrpn-databuttonincrement}
* * [`nrpn-databuttondecrement`]{@link InputChannel#event:nrpn-databuttondecrement}
* * [`nrpn-dataincrement`]{@link InputChannel#event:nrpn-dataincrement}
* * [`nrpn-datadecrement`]{@link InputChannel#event:nrpn-datadecrement}
*
* 8. **RPN** Events (channel-specific)
*
* * [`rpn`]{@link InputChannel#event:rpn}
* * [`rpn-dataentrycoarse`]{@link InputChannel#event:rpn-dataentrycoarse}
* * [`rpn-dataentryfine`]{@link InputChannel#event:rpn-dataentryfine}
* * [`rpn-databuttonincrement`]{@link InputChannel#event:rpn-databuttonincrement}
* * [`rpn-databuttondecrement`]{@link InputChannel#event:rpn-databuttondecrement}
* * [`rpn-dataincrement`]{@link InputChannel#event:rpn-dataincrement}
* * [`rpn-datadecrement`]{@link InputChannel#event:rpn-datadecrement}
*
* @param event {string} The type of the event.
*
Expand Down Expand Up @@ -784,8 +784,8 @@ export class Input extends EventEmitter {
* types (`noteon`, `controlchange`, etc.), that the message type must match in order to be
* forwarded. If this option is not specified, all types of messages will be forwarded. Valid
* messages are the ones found in either
* [`MIDI_SYSTEM_MESSAGES`](Enumerations#MIDI_SYSTEM_MESSAGES) or
* [`MIDI_CHANNEL_MESSAGES`](Enumerations#MIDI_CHANNEL_MESSAGES).
* [`SYSTEM_MESSAGES`](Enumerations#SYSTEM_MESSAGES) or
* [`CHANNEL_MESSAGES`](Enumerations#CHANNEL_MESSAGES).
* @param {number|number[]} [options.channels=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]]
* A MIDI channel number or an array of channel numbers that the message must match in order to be
* forwarded. By default all MIDI channels are included (`1` to `16`).
Expand Down
Loading

0 comments on commit ba31c03

Please sign in to comment.