diff --git a/.gitignore b/.gitignore index dc2f0a6..318d59f 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,7 @@ documentation/latex/refman.toc sources/motifs/.motifs.c.swp sources/motifs/.motifs.h.swp sources/motifs/motifs.o -sources/melodie/melodie.o \ No newline at end of file +sources/melodie/melodie.o +sources/.main.c.swp +sources/melodie/.melodie.c.swp +sources/melodie/.melodie.h.swp \ No newline at end of file diff --git a/sources/Makefile b/sources/Makefile new file mode 100644 index 0000000..cf96c65 --- /dev/null +++ b/sources/Makefile @@ -0,0 +1,14 @@ +ponytracker : main.o motifs.o melodie.o + gcc -Wall main.o motifs.o melodie.o -o ponytracker + +main.o : main.c + gcc -Wall -c main.c + +motifs.o : motifs/motifs.c motifs/motifs.h + gcc -Wall -c motifs/motifs.c + +melodie.o : motifs/melodie.c motifs/melodie.h + gcc -Wall -c melodie/melodie.c + +clean : + rm -f *.o diff --git a/sources/melodie/melodie.c b/sources/melodie/melodie.c index e44047b..f3d6db4 100644 --- a/sources/melodie/melodie.c +++ b/sources/melodie/melodie.c @@ -16,21 +16,21 @@ void definirCourant(int i){ courant = i; } -void ajouterMotifVirtuel(){ - for (int i = taille; i > courant; i--) { +void ajouterMotifVirtuel(Motif* melodie[], int ind, Motif* m){ + for (int i = taille; i > ind; i--) { melodie[i] = melodie[i-1]; } taille++; - melodie[courant] = liste; + melodie[ind] = m; } -void definirMotifVirtuel(Motif* m){ - melodie[courant] = m; +void definirMotifVirtuel(Motif* melodie[], int ind, Motif* m){ + melodie[ind] = m; } -void supprimerMotifVirtuel(){ +void supprimerMotifVirtuel(Motif* melodie[], int ind){ taille--; - for (int i = courant; i < taille; i--) { + for (int i = ind; i < taille; i--) { melodie[i] = melodie[i+1]; } } diff --git a/sources/melodie/melodie.h b/sources/melodie/melodie.h index 4a42b38..2901d14 100644 --- a/sources/melodie/melodie.h +++ b/sources/melodie/melodie.h @@ -5,10 +5,6 @@ #include #include "../motifs/motifs.h" -#define MAX_PATTERNS 256 - -Motif* melodie[MAX_PATTERNS] = {NULL}; - int courant = 0; int taille = 0; @@ -23,10 +19,10 @@ void afficherMotifActuel(); void definirCourant(int i); -void ajouterMotifVirtuel(); +void ajouterMotifVirtuel(Motif* melodie[], int ind, Motif* m); -void definirMotifVirtuel(Motif* m); +void definirMotifVirtuel(Motif* melodie[], int ind, Motif* m); -void supprimerMotifVirtuel(); +void supprimerMotifVirtuel(Motif* melodie[], int ind); -#endif \ No newline at end of file +#endif