From 33e4ec7e4aadf5dba18d23817f70f19e4419382f Mon Sep 17 00:00:00 2001 From: Raspbeguy Date: Sun, 6 Apr 2014 17:21:27 +0200 Subject: [PATCH] =?UTF-8?q?le=20module=20m=C3=A9lodie=20est=20propre,=20aj?= =?UTF-8?q?out=20d'un=20makefile=20provisoire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 ++++- sources/Makefile | 14 ++++++++++++++ sources/melodie/melodie.c | 14 +++++++------- sources/melodie/melodie.h | 12 ++++-------- 4 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 sources/Makefile 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