Compare commits

...

3 Commits

Author SHA1 Message Date
tth 4bd4e1c43f coronacommit 2020-05-13 12:38:06 +02:00
tth 10b2f53b85 oups... 2019-12-23 18:01:10 +01:00
tth 119a61c0e5 pre-xmas commit 2019-12-23 17:55:31 +01:00
14 changed files with 175 additions and 76 deletions

53
.gitignore vendored
View File

@ -7,58 +7,7 @@ nclooper
ui/t
files/t
# ---> C
# Prerequisites
*.d
sounds/*
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

View File

@ -1,12 +1,22 @@
#
# NC-LOOPER --- another kluge from tth
#
CC = gcc
CCOPT = -Wall -g -DDEBUG_LEVEL=1
CCOPT = -Wall -g -DDEBUG_LEVEL=0
OBJS = ui/ncfuncs.o files/smpllist.o files/ffuncs.o
LIBS = -lcurses
all: nclooper
main.o: main.c nclooper.h Makefile
$(CC) ${CCOPT} -c $<
interactive.o: interactive.c nclooper.h Makefile
$(CC) ${CCOPT} -c $<
OBJS += interactive.o
nclooper: main.o ${OBJS} Makefile
$(CC) ${CCOPT} $< ${OBJS} ${LIBS} -o $@

View File

@ -1,6 +1,9 @@
#
# NC-LOOPER --- another kluge from tth
#
CC = gcc
CCOPT = -Wall -g -DDEBUG_LEVEL=1
CCOPT = -Wall -g -DDEBUG_LEVEL=0
LIBS = -lao -lsndfile -lm
ao_output.o: ao_output.c Makefile

View File

@ -25,7 +25,7 @@ ao_device *device;
int foo;
device = init_ao_output(44100);
fprintf(stderr, "AO init -> %p\n", device);
if (verbosity) fprintf(stderr, "AO init -> %p\n", device);
switch (k) {
case 0:
@ -40,7 +40,7 @@ switch (k) {
}
foo = close_ao_output(device);
fprintf(stderr, "AO close -> %d\n", foo);
if (verbosity) fprintf(stderr, "AO close -> %d\n", foo);
return 0;
}

37
build.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# ------------------------------------------------------------------
function build
{
echo =================== $1 ====================
curdir=${PWD}
cd $1
make t
error=$?
cd ${curdir}
if [ ${error} -ne 0 ]
then
echo === error on $1 = ${error}
exit
fi
}
# ------------------------------------------------------------------
build files
build ui
build audio
# ------------------------------------------------------------------
printf "\n...final...\n"
make
# ------------------------------------------------------------------

View File

@ -1,5 +1,9 @@
#
# NC-LOOPER --- another kluge from tth
#
CC = gcc
CCOPT = -Wall -g -DDEBUG_LEVEL=1
CCOPT = -Wall -g -DDEBUG_LEVEL=0
ffuncs.o: ffuncs.c ffuncs.h Makefile
$(CC) ${CCOPT} -c $<

View File

@ -10,7 +10,7 @@
#include "smpllist.h"
/* --------------------------------------------------------------------- */
extern int verbosity;
extern int verbosity;
/* --------------------------------------------------------------------- */
void affiche_un_sample(SampleRef *sref, int options)
{
@ -18,7 +18,17 @@ printf("%c %02X [%-20s] %s\n", sref->key, sref->flags, sref->text,
sref->path);
}
/* --------------------------------------------------------------------- */
void affiche_liste_des_samples(SampleRef samples[])
{
int foo;
for (foo=0; foo<26; foo++) {
printf("%2d %02x %-30s %s\n", foo, samples[foo].key,
samples[foo].text,
samples[foo].path);
}
}
/* --------------------------------------------------------------------- */
int decode_la_ligne(char *line, SampleRef *sref)
{
char *ptr, *cp;
@ -91,7 +101,6 @@ fprintf(stderr, ">>> %s ( '%s' )\n", __func__, fname);
/*
* first step : clean the current list
*/
for (foo=0; foo<26; foo++) {
memset(samples+foo, 0, sizeof(SampleRef));
}
@ -116,7 +125,7 @@ while (NULL != fgets(line, T_LINE, fp)) {
memset(&sample, 0, sizeof(SampleRef));
foo = decode_la_ligne(line, &sample);
#if DEBUG_LEVEL
#if DEBUG_LEVEL > 1
fprintf(stderr, "decode la ligne -> %d\n\n", foo);
#endif
if (!foo) {

View File

@ -5,6 +5,8 @@
void affiche_un_sample(SampleRef *sref, int options);
void affiche_liste_des_samples(SampleRef samples[]);
int decode_la_ligne(char *line, SampleRef *sref);
int lecture_liste_des_samples(char *fname, SampleRef *array);

View File

@ -47,10 +47,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);
for (foo=0; foo<26; foo++) {
printf("%3d %02x %s\n", foo, the_samples[foo].key,
the_samples[foo].text);
}
affiche_liste_des_samples(the_samples);
return 0;
}

45
interactive.c Normal file
View File

@ -0,0 +1,45 @@
/*
* NCLOOPER INTERACTIVE
*/
#include <stdio.h>
#include <unistd.h>
#include "nclooper.h"
/* --------------------------------------------------------------------- */
extern int verbosity;
/* --------------------------------------------------------------------- */
int enter_interactive(SampleRef *psmpl, int notused)
{
int foo, row, col;
char txt[99];
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, psmpl, notused);
#endif
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();
}
sleep(3);
return -1;
}
/* --------------------------------------------------------------------- */

58
main.c
View File

@ -9,14 +9,12 @@
#include <ctype.h>
#include "nclooper.h"
// #include "files/smpllist.h"
// #include "files/ffuncs.h"
/* --------------------------------------------------------------------- */
int verbosity;
SampleRef the_samples[26];
SampleRef the_samples[26];
/* --------------------------------------------------------------------- */
void help(int k)
@ -25,18 +23,52 @@ puts("NcLooper : version pas finie...");
exit(0);
}
/* --------------------------------------------------------------------- */
/*
* all the basic engines are up, we have to fire ncurses
*/
int introduction(int k)
{
int foo;
ao_device *device;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %d )\n", __func__, k);
#endif
foo = init_ecran(__func__);
sleep(1);
/* check the sound subsystem */
return -1;
}
/* --------------------------------------------------------------------- */
int conclusion(int k)
{
int foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %d )\n", __func__, k);
#endif
foo = fin_ecran();
return -1;
}
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo;
int opt;
char *listname = "samples.list";
char *listname = "files/samples.list";
while ((opt = getopt(argc, argv, "hl:v")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'v': verbosity++; break;
case 'l': listname = optarg; break;
case 'v': verbosity++; break;
}
}
@ -44,14 +76,20 @@ while ((opt = getopt(argc, argv, "hl:v")) != -1) {
fprintf(stderr, "argc = %d, optind = %d\n", argc, optind);
#endif
foo = lecture_liste_des_samples(listname, the_samples);
fprintf(stderr,"retour lecture liste '%s' -> %d\n", listname, foo);
for (foo=0; foo<26; foo++) {
printf("%3d %02x %s\n", foo, the_samples[foo].key,
the_samples[foo].text);
}
foo = start_the_engine();
fprintf(stderr,"retour start engine -> %d\n", foo);
introduction(0);
foo = enter_interactive(the_samples, 0);
#if DEBUG_LEVEL
fprintf(stderr, "retour 'enter interactive' -> %d\n", foo);
#endif
conclusion(0);
return 0;
}

View File

@ -16,3 +16,8 @@ typedef struct {
#include "files/smpllist.h"
#include "files/ffuncs.h"
#include "ui/ncfuncs.h"
int enter_interactive(SampleRef *, int notused);

View File

@ -6,7 +6,7 @@
#include "ncfuncs.h"
/* --------------------------------------------------------------------- */
int init_ecran(char *txt)
int init_ecran(const char *txt)
{
initscr();

View File

@ -4,7 +4,7 @@
#include <curses.h>
int init_ecran(char *txt);
int init_ecran(const char *txt);
int fin_ecran(void);
int idx2position(int idx, int *prow, int *pcol);