Compare commits

..

No commits in common. "85c1846a0be8ba167e4d896c16a95fc7df74ee33" and "7c91072873890bfc0f03d72308c52327117c4bd7" have entirely different histories.

5 changed files with 11 additions and 31 deletions

View File

@ -6,8 +6,6 @@ pour lancer Chuck sans connexion audio.
## dessiner.ck ## dessiner.ck
Faire des courbes de Lissajous...
## pouet.ck ## pouet.ck
## midi2osc.ck ## midi2osc.ck

View File

@ -7,8 +7,8 @@
* *
*/ */
9000 => int OSCPort; 7777 => int OSCPort;
32760.0 => float Amplitude; 31000.0 => float Amplitude;
OscOut xmit; OscOut xmit;
float dx, dy; float dx, dy;
@ -20,19 +20,17 @@ clear_the_screen();
for (0 => int foo; foo<25800; foo++) { for (0 => int foo; foo<25800; foo++) {
<<< foo >>>; <<< foo >>>;
Amplitude * Math.sin(foo * 0.3001) => dx; Amplitude * Math.sin(foo * 0.30001) => dx;
Amplitude * Math.cos(foo * 0.4999) => dy; Amplitude * Math.cos(foo * 0.50001) => dy;
xmit.start("/joystick/xy"); xmit.start("/joystick/xy");
Std.ftoi(dx) => xmit.add; Std.ftoi(dx) => xmit.add;
Std.ftoi(dy) => xmit.add; Std.ftoi(dy) => xmit.add;
xmit.send(); xmit.send();
0.025::second => now; 0.02::second => now;
} }
// ----------------------------------------------------
fun void clear_the_screen() fun void clear_the_screen()
{ {
xmit.start("/joystick/b"); xmit.start("/joystick/b");
@ -42,5 +40,3 @@ xmit.start("/joystick/b");
50 => xmit.add; 0 => xmit.add; 50 => xmit.add; 0 => xmit.add;
xmit.send(); xmit.send();
} }
// ----------------------------------------------------

View File

@ -7,10 +7,8 @@
MidiIn input; MidiIn input;
MidiMsg msg; MidiMsg msg;
OscOut xmit;
1 => int port; // please explain 1 => int port; // please explain
9000 => int OSCPort;
if (!input.open(port)) { if (!input.open(port)) {
<<< "erreur open" >>>; <<< "erreur open" >>>;
@ -20,20 +18,12 @@ if (!input.open(port)) {
// print out device that was opened // print out device that was opened
<<< "MIDI device:", input.num(), " -> ", input.name() >>>; <<< "MIDI device:", input.num(), " -> ", input.name() >>>;
xmit.dest("localhost", OSCPort);
// infinite loop // infinite loop
while (1) { while (1) {
input => now; input => now;
while ( input.recv(msg) ) { while ( input.recv(msg) ) {
<<< msg.data1, msg.data2, msg.data3 >>>; <<< msg.data1, msg.data2, msg.data3 >>>;
xmit.start("/joystick/b");
} }

View File

@ -9,7 +9,7 @@ SqrOsc sl => Envelope envl => dac.left;
SawOsc sr => Envelope envr => dac.right; SawOsc sr => Envelope envr => dac.right;
0.5 => sl.gain => sr.gain; 0.5 => sl.gain => sr.gain;
0.01 => envl.time; 0.04 => envr.time; 0.01 => envl.time; 0.06 => envr.time;
OscIn oscin; OscMsg msg; OscIn oscin; OscMsg msg;
@ -33,7 +33,7 @@ while( true ) {
else { else {
1 => envl.keyOff => envr.keyOff; 1 => envl.keyOff => envr.keyOff;
} }
0.1::second => now; 0.2::second => now;
} }
} }

View File

@ -46,8 +46,6 @@ printf(stderr, "%s : %s %s %d\n", __func__, path, types, argc);
if (verbosity) { if (verbosity) {
sprintf(ligne, "%s %s %s %d\n", __func__, path, types, argc); sprintf(ligne, "%s %s %s %d\n", __func__, path, types, argc);
mvaddstr(2, 2, ligne); mvaddstr(2, 2, ligne);
sprintf(ligne, "button : %6d %6d", argv[0]->i, argv[1]->i);
mvaddstr(3, 2, ligne);
refresh(); refresh();
} }
@ -56,8 +54,6 @@ if (-1 == erase_button) return 0;
if ( (argv[0]->i == erase_button) && if ( (argv[0]->i == erase_button) &&
(argv[1]->i == 0) ) { (argv[1]->i == 0) ) {
must_erase = 1; must_erase = 1;
mvaddstr(3, 2, "KILL ! KILL !");
refresh();
} }
return 0; return 0;
@ -120,7 +116,7 @@ if (verbosity) {
} }
/* erase the old spot */ /* erase the old spot */
if (old_l || old_c) mvaddch(old_l, old_c, current_char); if (old_l) mvaddch(old_l, old_c, current_char);
standout(); standout();
mvaddch(cur_l, cur_c, '#'); mvaddch(cur_l, cur_c, '#');
@ -173,9 +169,9 @@ fprintf(stderr, "erase %d\n", erase_button);
st = lo_server_thread_new(local_port, error); st = lo_server_thread_new(local_port, error);
foo = initcurses(); foo = initcurses();
sprintf(ligne, ":%s e=%d ", local_port, erase_button); sprintf(ligne, ":%s ", local_port);
foo = draw_main_screen(ligne, 0); foo = draw_main_screen(ligne, 0);
// if (verbosity) fprintf(stderr, "dms %d\n", foo); if (verbosity) fprintf(stderr, "dms %d\n", foo);
lo_server_thread_add_method(st, "/joystick/xy", "ii", xy_handler, NULL); lo_server_thread_add_method(st, "/joystick/xy", "ii", xy_handler, NULL);
lo_server_thread_add_method(st, "/joystick/b", "ii", button_handler, NULL); lo_server_thread_add_method(st, "/joystick/b", "ii", button_handler, NULL);