some tuning...

This commit is contained in:
tTh 2023-01-13 15:36:31 +01:00
parent 655a528192
commit f804d2c7ab
10 changed files with 62 additions and 30 deletions

View File

@ -2,10 +2,10 @@
# umpf...
OPTS = -Wall -g -DDEBUG_LEVEL=1
OPTS = -Wall -g -DDEBUG_LEVEL=0
DEPS = Makefile
all: osc-joy osc2cursor text2osc
all: osc-joy osc2cursor text2osc showbuttons
# --------------------------------------------------------------

View File

@ -2,6 +2,10 @@
Oui, je sais, tout ça n'est pas vraiment clair. Mais je me soigne.
Première étape : consulter le
[site d'OSC](https://opensoundcontrol.stanford.edu/) pour comprendre comment
ça fonctionne.
## prérequis
Première étape avant de générer les binaires, installer quelques
@ -28,7 +32,7 @@ Et ensuite `make` dans le répertoire de base...
## osc-joy
Lecture d'une manette de jeu USB et envoi des x/y et des boutons
Lecture d'une manette de jeu USB et envoi des coordonnées x/y et des boutons
vers un écouteur OSC.
L'option `-o NN` rajoute NN au numéro de bouton.
@ -42,6 +46,10 @@ Une appli ncurses trop choupie :)
Pour faire __beep__ vers Chuck...
## showbuttons
Presque fini depuis quelques mois.
# Le reste
## Loth Project

View File

@ -1,4 +1,5 @@
/* faire pouet avec chuck osc et un joystick
/*
faire pouet avec chuck osc et un joystick
-----------------------------------------
reception des boutons
*/
@ -9,7 +10,7 @@ SqrOsc sl => Envelope envl => dac.left;
SawOsc sr => Envelope envr => dac.right;
0.5 => sl.gain => sr.gain;
0.01 => envl.time; 0.04 => envr.time;
0.22 => envl.time; 0.22 => envr.time;
OscIn oscin; OscMsg msg;

View File

@ -4,7 +4,7 @@
*/
7777 => int InPort;
15.55 => float divisor;
SqrOsc sl => dac.left;
SawOsc sr => dac.right;
0.0 => sl.gain => sr.gain;
@ -27,8 +27,8 @@ while( true ) {
msg.getInt(0) => x;
msg.getInt(1) => y;
<<< "got (via ", InPort,") ", x, y >>>;
x => sl.freq;
y => sr.freq;
x/12.0 => sl.freq;
y/12.0 => sr.freq;
}
}

View File

@ -24,7 +24,10 @@
\section{Open Sound Control}
De quoi parle-t-on exactement ?
\vspace{1em}
\vspace{5em}
OSC est un protocole réseau basé sur UDP\index{UDP}.
% -------------------------------------------------------------------
\section{Example}

View File

@ -68,7 +68,7 @@ return 0; /* this is not a magic number */
int blast_error_message(char *txt, int violence, int unused)
{
int line, foo;
char buff[60];
char buff[80];
#if DEBUG_LEVEL
fprintf(stderr, "--> %s ( '%s' %d %d )\n", __func__,
@ -82,20 +82,36 @@ if (verbosity > 3) {
}
standout();
// clear our part of screen
// setup our part of screen
for (foo=0; foo<COLS; foo++) {
mvaddch(line, foo, '_');
mvaddch(line, foo, '|');
}
mvaddstr(line, 0, "SYS$MSG_ ");
mvaddstr(line, 9, txt);
mvaddstr(line, 0, "SYS$MSG_| ");
mvaddstr(line, 10, txt);
standend();
refresh();
return 0;
}
/* ----------------------------------------------------------------- */
int erase_error_message(int ascii)
{
int foo;
#if DEBUG_LEVEL
fprintf(stderr, "--> %s ( '%c' )\n", __func__, ascii);
#endif
standout();
// clear our part of screen
for (foo=0; foo<COLS; foo++) {
mvaddch(LINES-1, foo, ascii);
}
standend(); refresh();
return 0;
}
/* ----------------------------------------------------------------- */
/* warning: only use the bit 0 of the 'state' arg */
int draw_a_button(WINDOW *w, int lig, int col, char *txt, int state)

View File

@ -9,6 +9,7 @@ void endcurses(int p);
int draw_main_screen(char *title, int unused);
int blast_error_message(char *txt, int violence, int unused);
int erase_error_message(int ascii);
/* warning: only use the bit 0 of the 'state' arg */
int draw_a_button(WINDOW *w, int lig, int col, char *txt, int state);

View File

@ -84,7 +84,7 @@ if (do_dump) {
}
if (verbosity) {
fprintf(stderr, "%s is sending to %s:%s\n", argv[0],
fprintf(stderr, " %s is sending to %s:%s\n", argv[0],
remote_host, remote_port);
fprintf(stderr, " the stick '%s' is on %s\n", my_id, joy_device);
}
@ -99,7 +99,7 @@ if( ( joy_fd = open(joy_device , O_RDONLY)) == -1 ) {
if (verbosity) {
if (ioctl(joy_fd, JSIOCGNAME(sizeof(joy_name)), joy_name) < 0)
strncpy(joy_name, "Unknown", sizeof(joy_name));
fprintf(stderr, "Name: %s\n", joy_name);
fprintf(stderr, " Name: %s\n", joy_name);
}
send_data_id(t, my_id);
@ -111,7 +111,6 @@ for (;;) {
fprintf(stderr, "err reading joy\n");
exit(1);
}
/* calibration datas ignored */
if (js.type > 128) continue;
@ -119,11 +118,9 @@ for (;;) {
fprintf(stderr, "%10u %2d %2d %7d\n",
js.time, js.type, js.number, js.value);
}
if (2==js.type) { /* oscillating stick */
flag = 0;
switch (js.number)
{
switch (js.number) {
case 0:
x_pos = js.value;
flag = 1;
@ -133,7 +130,6 @@ for (;;) {
flag = 1;
break;
}
if (flag) {
foo = send_data_xy(t, x_pos, y_pos);
flag = 0;
@ -144,7 +140,6 @@ for (;;) {
foo = send_data_button(t, js.number+button_offset,
js.value);
}
}
return 0;

View File

@ -294,9 +294,14 @@ lo_server_thread_add_method(st, "/joystick/xy", "ii",
xy_handler, NULL);
lo_server_thread_start(st);
sprintf(ligne, "process %d on board, captain", getpid());
#if DEBUG_LEVEL
fprintf(stderr, "pid %d: osc server thread started\n", getpid());
#endif
sprintf(ligne, "process %d on board, captain ", getpid());
blast_error_message(ligne, 0, 0);
sleep(1);
erase_error_message('-');
for (;;) {
/* wait for un event from liblo threads */

View File

@ -79,12 +79,15 @@ do {
if (verbosity) {
gettimeofday(&tp, NULL);
curtime = tp.tv_sec + tp.tv_usec / 1e6;
printf("----+ %4ld %5d b ts: %.3f\n",
printf("----+ frame %4ld %5d bytes t= %.3f sec.\n",
serial, foo, curtime - starttime);
/*
* MUST display ip:port of the sender !
*/
}
for (bar=0; bar<=foo; bar+=16) {
printf("%3ld | ", bar);
printf("%3d | ", bar);
dumpln(buffer+bar);
}
serial++;