wiping again...

This commit is contained in:
tth 2021-02-22 12:39:11 +01:00
parent af5f983a60
commit be1809ec16
3 changed files with 66 additions and 8 deletions

View File

@ -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;
}

21
main.c
View File

@ -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);

View File

@ -2,6 +2,7 @@
* NcLooper--- interface curses, fonctions de base
*/
#include <stdio.h>
#include <curses.h>
#include "ncfuncs.h"
@ -17,6 +18,8 @@ standend();
mvaddstr(1, 5, txt);
refresh();
keypad(stdscr, 1);
return -1;
}
/* --------------------------------------------------------------------- */