File tree Expand file tree Collapse file tree 10 files changed +44
-4
lines changed
Expand file tree Collapse file tree 10 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ export const WHATS_NEW: string[] = [
55 `Adjustable sample rate!` ,
66 `Switching between Chrome and Worklet mode!` ,
77 `Added support for poly/mono mode!` ,
8- `Fixed visual desync!`
8+ `Fixed visual desync!` ,
9+ `Added a new option to the keyboard!`
910] as const ;
Original file line number Diff line number Diff line change @@ -27,5 +27,11 @@ export const keyboardSettingsLocale = {
2727 show : {
2828 title : "Show" ,
2929 description : "Show/hide MIDI keyboard"
30+ } ,
31+
32+ forceMaxVelocity : {
33+ title : "Force full color" ,
34+ description :
35+ "Force full color intensity, regardless of the MIDI note-on velocity"
3036 }
3137} ;
Original file line number Diff line number Diff line change @@ -27,5 +27,10 @@ export const keyboardSettingsLocale = {
2727 show : {
2828 title : "Pokaż" ,
2929 description : "Pokaż/ukryj pianino"
30+ } ,
31+
32+ forceMaxVelocity : {
33+ title : "Wymuś pełny kolor" ,
34+ description : "Wymuś pełen kolor klawiszy podczas nacisku"
3035 }
3136} ;
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export class MIDIKeyboard {
1919 public onNotePressed ?: ( midiNote : number , velocity : number ) => unknown ;
2020 public channel = 0 ;
2121 public mode : InterfaceMode = "light" ;
22+ public forceMaxVelocity = false ;
2223 protected mouseHeld = false ;
2324 protected pressedKeys = new Set < number > ( ) ;
2425 protected sizeChangeAnimationId = - 1 ;
@@ -307,7 +308,7 @@ export class MIDIKeyboard {
307308 key . classList . add ( "pressed" ) ;
308309
309310 const isSharp = key . classList . contains ( "sharp_key" ) ;
310- const brightness = velocity / 127 ;
311+ const brightness = this . forceMaxVelocity ? 1 : velocity / 127 ;
311312 const rgbaValues = this . channelColors [ channel % 16 ]
312313 . match ( / \d + ( \. \d + ) ? / g)
313314 ?. map ( ( element ) => Number . parseFloat ( element ) ) ;
Original file line number Diff line number Diff line change @@ -239,4 +239,11 @@ export function _createKeyboardHandler(this: SpessaSynthSettings) {
239239 this . midiKeyboard . shown = ! this . midiKeyboard . shown ;
240240 this . saveSettings ( ) ;
241241 } ) ;
242+
243+ // Keyboard max velocity
244+ keyboardControls . maxVelocitySelector . addEventListener ( "click" , ( ) => {
245+ this . midiKeyboard . forceMaxVelocity =
246+ ! this . midiKeyboard . forceMaxVelocity ;
247+ this . saveSettings ( ) ;
248+ } ) ;
242249}
Original file line number Diff line number Diff line change @@ -150,6 +150,11 @@ export async function _loadSettings(this: SpessaSynthSettings): Promise<void> {
150150 this . htmlControls . keyboard . showSelector . checked = false ;
151151 }
152152
153+ // Keyboard force max velocity
154+ if ( ! keyboardValues . forceMaxVelocity ) {
155+ keyboard . forceMaxVelocity = true ;
156+ this . htmlControls . keyboard . maxVelocitySelector . checked = true ;
157+ }
153158 // Interface
154159 this . locale . changeGlobalLocale ( savedSettings . interface . language , true ) ;
155160
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ export function _serializeSettings(this: SpessaSynthSettings): SavedSettings {
3838 autoRange :
3939 this . htmlControls . keyboard . sizeSelector . value ===
4040 USE_MIDI_RANGE ,
41- show : this . htmlControls . keyboard . showSelector . checked
41+ show : this . htmlControls . keyboard . showSelector . checked ,
42+ forceMaxVelocity :
43+ this . htmlControls . keyboard . maxVelocitySelector . checked
4244 } ,
4345
4446 midi : {
Original file line number Diff line number Diff line change @@ -332,7 +332,10 @@ export class SpessaSynthSettings {
332332 "#keyboard_size_selector"
333333 ) ! ,
334334 showSelector :
335- document . querySelector < HTMLInputElement > ( "#keyboard_show" ) !
335+ document . querySelector < HTMLInputElement > ( "#keyboard_show" ) ! ,
336+ maxVelocitySelector : document . querySelector < HTMLInputElement > (
337+ "#keyboard_force_max_velocity"
338+ ) !
336339 } ,
337340
338341 midi : {
Original file line number Diff line number Diff line change @@ -130,6 +130,14 @@ export const settingsHtml = `
130130 <span class='switch_slider'></span>
131131 </label>
132132 </div>
133+
134+ <div class='switch_label'>
135+ <label translate-path-title='locale.settings.keyboardSettings.forceMaxVelocity'></label>
136+ <label class='switch'>
137+ <input type='checkbox' checked id='keyboard_force_max_velocity'>
138+ <span class='switch_slider'></span>
139+ </label>
140+ </div>
133141 </div>
134142
135143
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export interface SavedSettings {
2020 selectedChannel : number ;
2121 autoRange : boolean ;
2222 show : boolean ;
23+ forceMaxVelocity : boolean ;
2324 } ;
2425 renderer : {
2526 renderNotes : boolean ;
@@ -56,6 +57,7 @@ export const DEFAULT_SAVED_SETTINGS: SavedSettings = {
5657 mode : "light" ,
5758 selectedChannel : 0 ,
5859 show : true ,
60+ forceMaxVelocity : false ,
5961 autoRange : false ,
6062 keyRange : {
6163 max : 127 ,
You can’t perform that action at this time.
0 commit comments