Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MIDI: add controller mapping to settings dialog box

  • Loading branch information...
commit a815873e09e67de842f3370a7099e2eff7e2b3b3 1 parent 26c25be
Sébastien Bourdeauducq authored June 09, 2011
1  src/framedescriptor.h
@@ -35,6 +35,7 @@ enum {
35 35
 
36 36
 #define IDMX_COUNT 8
37 37
 #define OSC_COUNT 4
  38
+#define MIDI_COUNT 8
38 39
 #define DMX_COUNT 8
39 40
 
40 41
 struct frame_descriptor {
68  src/midi.c
@@ -32,6 +32,7 @@
32 32
 #include "messagebox.h"
33 33
 #include "filedialog.h"
34 34
 #include "performance.h"
  35
+#include "framedescriptor.h"
35 36
 
36 37
 #include "midi.h"
37 38
 
@@ -252,7 +253,7 @@ static void note_event(int code)
252 253
 
253 254
 static void controller_event(int controller, int value)
254 255
 {
255  
-	printf("MIDI controller %d: %d\n", controller, value);
  256
+	mtk_cmdf(appid, "l_lastctl.set(-text \"%d (%d)\")", controller, value);
256 257
 }
257 258
 
258 259
 static void midi_event(mtk_event *e, int count)
@@ -402,13 +403,15 @@ static void autobuild_callback(mtk_event *e, void *arg)
402 403
 
403 404
 void init_midi()
404 405
 {
  406
+	int i;
  407
+	
405 408
 	appid = mtk_init_app("MIDI");
406 409
 
407 410
 	mtk_cmd_seq(appid,
408 411
 		"g = new Grid()",
409 412
 
410 413
 		"g_parameters0 = new Grid()",
411  
-		"l_parameters = new Label(-text \"Parameters\" -font \"title\")",
  414
+		"l_parameters = new Label(-text \"Global parameters\" -font \"title\")",
412 415
 		"s_parameters1 = new Separator(-vertical no)",
413 416
 		"s_parameters2 = new Separator(-vertical no)",
414 417
 		"g_parameters0.place(s_parameters1, -column 1 -row 1)",
@@ -420,6 +423,10 @@ void init_midi()
420 423
 		"g_parameters.place(l_channel, -column 1 -row 1)",
421 424
 		"g_parameters.place(e_channel, -column 2 -row 1)",
422 425
 
  426
+		"g_sep = new Grid()",
  427
+
  428
+		"g_patch = new Grid()",
  429
+
423 430
 		"g_existing0 = new Grid()",
424 431
 		"l_existing = new Label(-text \"Existing bindings\" -font \"title\")",
425 432
 		"s_existing1 = new Separator(-vertical no)",
@@ -455,29 +462,64 @@ void init_midi()
455 462
 		"g_addedit1.columnconfig(4, -size 0)",
456 463
 		"b_addupdate = new Button(-text \"Add/update\")",
457 464
 		"b_autobuild = new Button(-text \"Auto build\")",
458  
-
  465
+		
  466
+		"g_patch.place(g_existing0, -column 1 -row 1)",
  467
+		"g_patch.place(lst_existingf, -column 1 -row 2)",
  468
+		"g_patch.rowconfig(2, -size 130)",
  469
+		"g_patch.place(g_addedit0, -column 1 -row 3)",
  470
+		"g_patch.place(g_addedit1, -column 1 -row 4)",
  471
+		"g_patch.place(b_addupdate, -column 1 -row 5)",
  472
+		"g_patch.place(b_autobuild, -column 1 -row 6)",
  473
+		
  474
+		"g_var = new Grid()",
  475
+		
  476
+		"g_cmap0 = new Grid()",
  477
+		"l_cmap = new Label(-text \"Controller mapping\" -font \"title\")",
  478
+		"s_cmap1 = new Separator(-vertical no)",
  479
+		"s_cmap2 = new Separator(-vertical no)",
  480
+		"g_cmap0.place(s_cmap1, -column 1 -row 1)",
  481
+		"g_cmap0.place(l_cmap, -column 2 -row 1)",
  482
+		"g_cmap0.place(s_cmap2, -column 3 -row 1)",
  483
+		
  484
+		"g_vars = new Grid()",
  485
+		"g_vars.columnconfig(2, -size 55)",
  486
+		
  487
+		"l_lastctltxt = new Label(-text \"Latest active controller:\")",
  488
+		"l_lastctl = new Label()",
  489
+		
  490
+		"g_var.place(g_cmap0, -column 1 -row 1)",
  491
+		"g_var.place(g_vars, -column 1 -row 2)",
  492
+		"g_var.place(l_lastctltxt, -column 1 -row 3)",
  493
+		"g_var.place(l_lastctl, -column 1 -row 4)",
  494
+
  495
+		"g_sep.place(g_patch, -column 1 -row 1)",
  496
+		"sep = new Separator(-vertical yes)",
  497
+		"g_sep.place(sep, -column 2 -row 1)",
  498
+		"g_sep.place(g_var, -column 3 -row 1)",
  499
+		
459 500
 		"g_btn = new Grid()",
460 501
 		"b_ok = new Button(-text \"OK\")",
461 502
 		"b_cancel = new Button(-text \"Cancel\")",
462  
-		"g_btn.columnconfig(1, -size 200)",
  503
+		"g_btn.columnconfig(1, -size 450)",
463 504
 		"g_btn.place(b_ok, -column 2 -row 1)",
464 505
 		"g_btn.place(b_cancel, -column 3 -row 1)",
465 506
 
466 507
 		"g.place(g_parameters0, -column 1 -row 1)",
467 508
 		"g.place(g_parameters, -column 1 -row 2)",
468  
-		"g.place(g_existing0, -column 1 -row 3)",
469  
-		"g.place(lst_existingf, -column 1 -row 4)",
470  
-		"g.rowconfig(4, -size 130)",
471  
-		"g.place(g_addedit0, -column 1 -row 5)",
472  
-		"g.place(g_addedit1, -column 1 -row 6)",
473  
-		"g.place(b_addupdate, -column 1 -row 7)",
474  
-		"g.place(b_autobuild, -column 1 -row 8)",
475  
-		"g.rowconfig(9, -size 10)",
476  
-		"g.place(g_btn, -column 1 -row 10)",
  509
+		"g.place(g_sep, -column 1 -row 3)",
  510
+		"g.rowconfig(4, -size 10)",
  511
+		"g.place(g_btn, -column 1 -row 5)",
477 512
 
478 513
 		"w = new Window(-content g -title \"MIDI settings\")",
479 514
 		0);
480 515
 
  516
+	for(i=0;i<MIDI_COUNT;i++) {
  517
+		mtk_cmdf(appid, "l_midi%d = new Label(-text \"midi%d\")", i, i+1);
  518
+		mtk_cmdf(appid, "e_midi%d = new Entry()", i);
  519
+		mtk_cmdf(appid, "g_vars.place(l_midi%d, -column 1 -row %d)", i, i);
  520
+		mtk_cmdf(appid, "g_vars.place(e_midi%d, -column 2 -row %d)", i, i);
  521
+	}
  522
+
481 523
 	mtk_bind(appid, "lst_existing", "selchange", selchange_callback, NULL);
482 524
 	mtk_bind(appid, "lst_existing", "selcommit", selchange_callback, NULL);
483 525
 	mtk_bind(appid, "b_filename", "commit", browse_callback, NULL);

0 notes on commit a815873

Please sign in to comment.
Something went wrong with that request. Please try again.