@@ -12,8 +12,8 @@ function slider_factory() {
1212 const DEFAULT_SLIDER_MIN_WIDTH = 50 ;
1313 const DEFAULT_SLIDER_MIN_HEIGHT = 100 ;
1414 const DEFAULT_SLIDER_TOUCHS = 1 ;
15- const DEFAULT_SLIDER_TOUCHS_MODE = C_CHANGE ;
16- const DEFAULT_SLIDER_TOUCHS_MODE_Z = NOTE_ON ;
15+ const DEFAULT_SLIDER_MODE_POS = C_CHANGE ;
16+ const DEFAULT_SLIDER_MODE_Z = NOTE_ON ;
1717 const DEFAULT_SLIDER_DIR = "V_SLIDER" ;
1818
1919 let current_frame_width = null ;
@@ -25,9 +25,9 @@ function slider_factory() {
2525 "name" : "slider" ,
2626 "dir" : null ,
2727 "modes" : {
28- 0 : "NOTE_ON" , // TRIGGER WITH VELOCITY
29- 1 : "C_CHANGE" , // PRESSURE ONLY
30- 2 : "AFTERTOUCH_POLY" // TRIGGER AND PRESSURE
28+ 0 : "NOTE_ON" , // TRIGGER NOTE WITH VELOCITY
29+ 1 : "C_CHANGE" , // PRESSURE ONLY
30+ 2 : "AFTERTOUCH_POLY" // TRIGGER NOTE AND MODULATE
3131 } ,
3232 "data" : {
3333 "touchs" : null ,
@@ -40,7 +40,7 @@ function slider_factory() {
4040 setup_from_mouse_event : function ( mouseEvent ) {
4141 this . dir = DEFAULT_SLIDER_DIR ;
4242 this . data . touchs = DEFAULT_SLIDER_TOUCHS ;
43- this . data . mode_z = DEFAULT_SLIDER_TOUCHS_MODE_Z ;
43+ this . data . mode_z = DEFAULT_SLIDER_MODE_Z ;
4444 this . data . from = new paper . Point (
4545 mouseEvent . point . x - ( DEFAULT_SLIDER_WIDTH / 2 ) ,
4646 mouseEvent . point . y - ( DEFAULT_SLIDER_HEIGHT / 2 )
@@ -50,12 +50,23 @@ function slider_factory() {
5050 mouseEvent . point . y + ( DEFAULT_SLIDER_HEIGHT / 2 )
5151 ) ;
5252 this . data . msg = [ ] ;
53- let touch_msg ;
5453 for ( let _touch = 0 ; _touch < DEFAULT_SLIDER_TOUCHS ; _touch ++ ) {
55- touch_msg = { } ;
56- touch_msg . pos = midi_msg_builder ( DEFAULT_SLIDER_TOUCHS_MODE ) ;
57- touch_msg . press = midi_msg_builder ( DEFAULT_SLIDER_TOUCHS_MODE_Z ) ;
58- this . data . msg . push ( touch_msg ) ;
54+ let touch_msg = { } ;
55+ touch_msg . pos = midi_msg_builder ( DEFAULT_SLIDER_MODE_POS ) ;
56+ switch ( this . data . mode_z ) {
57+ case NOTE_ON :
58+ touch_msg . note = midi_msg_builder ( NOTE_ON ) ;
59+ //touch_msg.press = null;
60+ break ;
61+ case C_CHANGE :
62+ //touch_msg.note = null;
63+ touch_msg . press = midi_msg_builder ( C_CHANGE ) ;
64+ break ;
65+ case AFTERTOUCH_POLY :
66+ touch_msg . note = midi_msg_builder ( NOTE_ON ) ;
67+ touch_msg . press = midi_msg_builder ( C_CHANGE ) ;
68+ break ;
69+ } this . data . msg . push ( touch_msg ) ;
5970 }
6071 } ,
6172
@@ -84,32 +95,49 @@ function slider_factory() {
8495 save_params : function ( ) {
8596 this . dir = this . children [ "slider-group" ] . dir ;
8697 let previous_touch_count = this . data . touchs ;
87- let previous_touch_mode_z = this . data . mode_z ;
8898 this . data . touchs = this . children [ "slider-group" ] . data . touchs ;
8999 this . data . from = this . children [ "slider-group" ] . data . from ;
90100 this . data . to = this . children [ "slider-group" ] . data . to ;
101+
102+ let previous_mode_z = this . data . mode_z ;
91103 this . data . mode_z = this . children [ "slider-group" ] . data . mode_z ;
92104
93105 this . data . msg = [ ] ;
94- if ( this . data . mode_z !== previous_touch_mode_z ) {
106+ if ( this . data . mode_z != previous_mode_z ) {
95107 for ( let _touch = 0 ; _touch < this . data . touchs ; _touch ++ ) {
96108 let touch_msg = { } ;
97- touch_msg . pos = midi_msg_builder ( DEFAULT_SLIDER_TOUCHS_MODE ) ;
109+ touch_msg . pos = midi_msg_builder ( DEFAULT_SLIDER_MODE_POS ) ;
98110 touch_msg . press = midi_msg_builder ( this . data . mode_z ) ;
99111 this . data . msg . push ( touch_msg ) ;
100112 }
101113 }
102114 else {
103115 for ( let _touch = 0 ; _touch < this . data . touchs ; _touch ++ ) {
104116 if ( _touch < previous_touch_count ) {
105- let status = midi_msg_status_unpack ( this . children [ "touchs-group" ] . children [ _touch ] . msg . press . midi . status ) ;
106- let new_status = midi_msg_status_pack ( this . data . mode_z , status . channel ) ;
107- this . children [ "touchs-group" ] . children [ _touch ] . msg . press . midi . status = new_status ;
117+ // ERROR -> QUIK_FIXME
118+ //let status = midi_msg_status_unpack(this.children["touchs-group"].children[_touch].msg.press.midi.status);
119+ //let new_status = midi_msg_status_pack(this.data.mode_z, status.channel);
120+ //this.children["touchs-group"].children[_touch].msg.press.midi.status = new_status;
108121 this . data . msg . push ( this . children [ "touchs-group" ] . children [ _touch ] . msg ) ;
109122 }
110123 else {
111124 let touch_msg = { } ;
112- touch_msg . pos = midi_msg_builder ( DEFAULT_SLIDER_TOUCHS_MODE ) ;
125+ touch_msg . pos = midi_msg_builder ( DEFAULT_SLIDER_MODE_POS ) ;
126+ switch ( this . data . mode_z ) {
127+ case NOTE_ON :
128+ touch_msg . note = midi_msg_builder ( NOTE_ON ) ;
129+ //touch_msg.press = null;
130+ break ;
131+ case C_CHANGE :
132+ //touch_msg.note = null;
133+ touch_msg . press = midi_msg_builder ( C_CHANGE ) ;
134+ break ;
135+ case AFTERTOUCH_POLY :
136+ touch_msg . note = midi_msg_builder ( NOTE_ON ) ;
137+ touch_msg . press = midi_msg_builder ( C_CHANGE ) ;
138+ break ;
139+ }
140+
113141 touch_msg . press = midi_msg_builder ( this . data . mode_z ) ;
114142 this . data . msg . push ( touch_msg ) ;
115143 }
@@ -221,7 +249,7 @@ function slider_factory() {
221249 _touch_circle . onMouseDrag = function ( mouseEvent ) {
222250 switch ( e256_current_mode ) {
223251 case EDIT_MODE :
224- // NA
252+ // N/A
225253 break ;
226254 case PLAY_MODE :
227255 switch ( _slider . dir ) {
@@ -468,7 +496,7 @@ function slider_factory() {
468496 update_item_main_params ( _slider_group . parent ) ;
469497 break ;
470498 case PLAY_MODE :
471- // NA
499+ // N/A
472500 break ;
473501 }
474502 }
@@ -487,7 +515,7 @@ function slider_factory() {
487515 }
488516 break ;
489517 case PLAY_MODE :
490- // NA
518+ // N/A
491519 break ;
492520 }
493521 }
0 commit comments