From 194d20ea3a1a43f13ab31306604f73f9b8b6567a Mon Sep 17 00:00:00 2001 From: Raspbeguy Date: Sun, 6 Apr 2014 20:24:35 +0200 Subject: [PATCH] Suppression des lignes de debug, ajout de getters --- sources/main.c | 10 ++++------ sources/motifs/motifs.c | 20 ++++++++++++++++++++ sources/motifs/motifs.h | 12 ++++++++++++ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/sources/main.c b/sources/main.c index 15fe5b5..62fce0f 100644 --- a/sources/main.c +++ b/sources/main.c @@ -11,9 +11,9 @@ void afficherMotif(Motif* m, int nbrPortees){ printf("%s :\n",m->nom); - for (int i = 0; i < m->nbrTmp; i++){ - for (int j = 0; j < nbrPortees; j++){ - printf("%d ",(*m->motif)[j][i].note); + for (int tmp = 0; tmp < m->nbrTmp; tmp++){ + for (int portee = 0; portee < nbrPortees; portee++){ + printf("%d ",getNote(m,portee,tmp)); } printf("\n"); } @@ -25,11 +25,9 @@ int main(){ int nbrPortees = 1; courant = 0; taille = 0; - printf("abwabwa %d\n", getIdMotif(liste)); ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees); - printf("abwabwa %d\n", getIdMotif(liste)); - printf("caca %d\n", liste->nbrTmp); Motif* m = liste; + definirNote(m,0,4,5); ajouterMotifVirtuel(melodie,0,m); afficherMotif(m,nbrPortees); return EXIT_SUCCESS; diff --git a/sources/motifs/motifs.c b/sources/motifs/motifs.c index c9ffa11..d67c87e 100644 --- a/sources/motifs/motifs.c +++ b/sources/motifs/motifs.c @@ -63,3 +63,23 @@ void definirEffet(Motif* m, int portee, int tmp, int effet){ void supprimerNote(Motif* m, int portee, int tmp){ (*(*m->motif)[portee])[tmp].note = 0; } + +int getNote(Motif* m, int portee, int tmp){ + return (*(*m->motif)[portee])[tmp].note; +} + +int getOctave(Motif* m, int portee, int tmp){ + return (*(*m->motif)[portee])[tmp].octave; +} + +int getInstrument(Motif* m, int portee, int tmp){ + return (*(*m->motif)[portee])[tmp].instrument; +} + +int getVolume(Motif* m, int portee, int tmp){ + return (*(*m->motif)[portee])[tmp].volume; +} + +int getEffet(Motif* m, int portee, int tmp){ + return (*(*m->motif)[portee])[tmp].note; +} diff --git a/sources/motifs/motifs.h b/sources/motifs/motifs.h index 43d7ef6..6f13db4 100644 --- a/sources/motifs/motifs.h +++ b/sources/motifs/motifs.h @@ -49,4 +49,16 @@ void definirEffet(Motif* m, int portee, int tmp, int effet); void supprimerNote(Motif* m, int portee, int tmp); +// Maintenant, voici les getters (qui intéressent entre autres Majora) + +int getNote(Motif* m, int portee, int tmp); + +int getOctave(Motif* m, int portee, int tmp); + +int getInstrument(Motif* m, int portee, int tmp); + +int getVolume(Motif* m, int portee, int tmp); + +int getEffet(Motif* m, int portee, int tmp); + #endif