From be1809ec1688d4ce2dcb886cef9e6f74edfef489 Mon Sep 17 00:00:00 2001 From: tth Date: Mon, 22 Feb 2021 12:39:11 +0100 Subject: [PATCH] wiping again... --- interactive.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------ main.c | 21 +++++++++++++++++++-- ui/ncfuncs.c | 3 +++ 3 files changed, 66 insertions(+), 8 deletions(-) diff --git a/interactive.c b/interactive.c index 0468c03..321ee63 100644 --- a/interactive.c +++ b/interactive.c @@ -11,6 +11,47 @@ extern int verbosity; +/* --------------------------------------------------------------------- */ +static int la_grande_boucle(SampleRef *psmpl, int notused) +{ +static int curpos = 0; +int key; +int flag_exit = 0; +char line[120]; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %d )\n", __func__, psmpl, notused); +#endif + +do { + + sprintf(line, "curpos %4d", curpos); + mvaddstr(1,50, line); + + refresh(); + + /* - - - - handle human input, be careful */ + noecho(); + key = getch(); + echo(); + // sprintf(line, " key %4d", key); + // mvaddstr(2,50, line); + + switch(key) { + case KEY_UP: + if (curpos < 25) curpos++; + break; + case KEY_DOWN: + if (curpos > 0) curpos--; + break; + } // end of swict + + + flag_exit = ('X' == key); + } while ( ! flag_exit ); + +return -1; +} /* --------------------------------------------------------------------- */ int enter_interactive(SampleRef *psmpl, int notused) { @@ -23,22 +64,19 @@ fprintf(stderr, ">>> %s ( %p %d )\n", __func__, psmpl, notused); for (foo=0; foo<26; foo++) { - idx2position(foo, &row, &col); sprintf(txt, "%3d", foo); mvaddstr(row, col, txt); - if (psmpl[foo].key) { standout(); mvaddch(row, col+4, psmpl[foo].key); standend(); } - - refresh(); - } +refresh(); -sleep(3); +foo = la_grande_boucle(psmpl, notused); /* wtf ? + notused is used ? */ return -1; } diff --git a/main.c b/main.c index 17358c2..39a187b 100644 --- a/main.c +++ b/main.c @@ -42,6 +42,21 @@ sleep(1); /* check the sound subsystem */ +return -1; +} +/* --------------------------------------------------------------------- */ +int start_the_engine(int k) +{ + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %d )\n", __func__, k); +#endif + +if (k) { + fprintf(stderr, "%s: k %d is not null ?\n", __func__, k); + exit(1); + } + return -1; } /* --------------------------------------------------------------------- */ @@ -63,12 +78,14 @@ int main(int argc, char *argv[]) { int foo; int opt; +int mode = 0; char *listname = "files/samples.list"; -while ((opt = getopt(argc, argv, "hl:v")) != -1) { +while ((opt = getopt(argc, argv, "hl:m:v")) != -1) { switch(opt) { case 'h': help(0); break; case 'l': listname = optarg; break; + case 'm': mode = atoi(optarg); break; case 'v': verbosity++; break; } } @@ -80,7 +97,7 @@ fprintf(stderr, "argc = %d, optind = %d\n", argc, optind); foo = lecture_liste_des_samples(listname, the_samples); fprintf(stderr,"retour lecture liste '%s' -> %d\n", listname, foo); -foo = start_the_engine(); +foo = start_the_engine(mode); fprintf(stderr,"retour start engine -> %d\n", foo); introduction(0); diff --git a/ui/ncfuncs.c b/ui/ncfuncs.c index 34ff1f5..9ef7e1a 100644 --- a/ui/ncfuncs.c +++ b/ui/ncfuncs.c @@ -2,6 +2,7 @@ * NcLooper--- interface curses, fonctions de base */ +#include #include #include "ncfuncs.h" @@ -17,6 +18,8 @@ standend(); mvaddstr(1, 5, txt); refresh(); +keypad(stdscr, 1); + return -1; } /* --------------------------------------------------------------------- */