Skip to content

Commit

Permalink
gsuiKeys: velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
mr21 committed Jun 8, 2024
1 parent 867bc0d commit 14c9025
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gsuiKeys/gsuiKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class gsuiKeys extends gsui0ne {
$midiReleaseAllKeys() {
this.#keysDown.forEach( ( _, midi ) => this.$midiKeyUp( midi ) );
}
$midiKeyDown( midi ) {
this.#keyUpDown( this.#getKeyElementFromMidi( midi ), true );
$midiKeyDown( midi, vel ) {
this.#keyUpDown( this.#getKeyElementFromMidi( midi ), true, vel );
}
$midiKeyUp( midi ) {
this.#keyUpDown( this.#getKeyElementFromMidi( midi ), false );
Expand Down Expand Up @@ -139,17 +139,17 @@ class gsuiKeys extends gsui0ne {
#isBlack( keyInd ) {
return keyInd === 1 || keyInd === 3 || keyInd === 5 || keyInd === 8 || keyInd === 10;
}
#keyUpDown( elKey, status ) {
#keyUpDown( elKey, status, vel ) {
if ( elKey ) {
const midi = +elKey.dataset.midi;

elKey.classList.toggle( "gsui-active", status );
if ( status ) {
this.#keysDown.set( midi );
this.$dispatch( "keyDown", midi, this.#gain );
this.$dispatch( "keyDown", midi, vel );
} else {
this.#keysDown.delete( midi );
this.$dispatch( "keyUp", midi, this.#gain );
this.$dispatch( "keyUp", midi );
}
}
}
Expand Down Expand Up @@ -206,7 +206,7 @@ class gsuiKeys extends gsui0ne {
this.#keyUpDown( this.children[ currKeyInd ], false );
}
this.#keyIndByPtr.set( e.pointerId, iKeyInd );
this.#keyUpDown( elKey, true );
this.#keyUpDown( elKey, true, this.#gain );
}
}
}
Expand Down

0 comments on commit 14c9025

Please sign in to comment.