Maintenant la fonction lecture ne fait plus planter le programme. Mais ça marche toujours pas.
This commit is contained in:
19
sources/tests/makefile
Normal file
19
sources/tests/makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
all : test clean
|
||||
|
||||
test : test.o lecture.o melodie.o motifs.o
|
||||
gcc -std=c99 -L/opt/local/lib test.o lecture.o melodie.o motifs.o -o test -lSDL2 -lSDL2_mixer
|
||||
|
||||
test.o : test.c
|
||||
gcc -std=c99 -I/opt/local/include -Wall -c test.c
|
||||
|
||||
lecture.o : ../lecture/lecture.c ../lecture/lecture.h
|
||||
gcc -std=c99 -I/opt/local/include -Wall -c ../lecture/lecture.c
|
||||
|
||||
melodie.o : ../melodie/melodie.c ../melodie/melodie.h
|
||||
gcc -std=c99 -Wall -c ../melodie/melodie.c
|
||||
|
||||
motifs.o : ../motifs/motifs.c ../motifs/motifs.h
|
||||
gcc -std=c99 -Wall -c ../motifs/motifs.c
|
||||
|
||||
clean :
|
||||
rm -f *.o
|
||||
45
sources/tests/test.c
Normal file
45
sources/tests/test.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../lecture/lecture.h"
|
||||
|
||||
#define DEF_NBR_TMP 16
|
||||
#define MAX_PATTERNS 256
|
||||
|
||||
void afficherMotif(Motif* m, int nbrPortees){
|
||||
printf("%s :\n",m->nom);
|
||||
for (int tmp = 0; tmp < m->nbrTmp; tmp++){
|
||||
for (int portee = 0; portee < nbrPortees; portee++){
|
||||
printf("N=%d I=%d",getNote(m,portee,tmp),getInstrument(m,portee,tmp));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void debut(Motif* melodie[], Motif* liste, int nbrPortees){
|
||||
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
||||
Motif* m = liste;
|
||||
definirNote(m,0,4,5);
|
||||
definirNote(m,0,2,9);
|
||||
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
||||
Motif* n = liste;
|
||||
definirNote(n,0,10,3);
|
||||
definirNote(n,0,6,7);
|
||||
ajouterMotifVirtuel(melodie,0,m);
|
||||
ajouterMotifVirtuel(melodie,1,n);
|
||||
ajouterMotifVirtuel(melodie,2,m);
|
||||
ajouterMotifVirtuel(melodie,3,n);
|
||||
}
|
||||
|
||||
|
||||
int main(){
|
||||
Motif* melodie[MAX_PATTERNS] = {NULL};
|
||||
Motif* liste = NULL;
|
||||
int nbrPortees = 1;
|
||||
courant = 0;
|
||||
taille = 0;
|
||||
debut(melodie, liste, nbrPortees);
|
||||
for (int i = 0; i < taille; i++) {
|
||||
afficherMotif(melodie[i], nbrPortees);
|
||||
}
|
||||
lecture(nbrPortees,melodie);
|
||||
}
|
||||
Reference in New Issue
Block a user