#include #include "motifs.h" int getIdMotif(Motif* m){ if (m == NULL) { return 0; } else { return getIdMotif(m->suivant)+1; } } void ajouterMotif(Motif** pliste, int nbrTmp, int nbrPortees){ Motif* m = malloc(sizeof(Motif)); m->nbrTmp = DEFNBRTMP; m->suivant = *pliste; m->motif = malloc(nbrPortees*sizeof(Portee*)); strcpy(m->nom,"Motif "); char nombre[10]; sprintf(nombre,"%d",getIdMotif(m)); strcat(m->nom, nombre); int i; for (i=0; imotif)[i] = calloc(DEFNBRTMP,sizeof(Note)); } *pliste = m; } void definirNomMotif(Motif* m, char* nom){ strcpy(m->nom,nom); } void supprimerMotif(Motif** cellule, int nbrPortees){ int i; for (i=0; imotif))[i]); } free((*cellule)->motif); Motif* aux = (*cellule)->suivant; free((*cellule)); *cellule = aux; } void definirNote(Motif* m, int portee, int tmp, int note){ (*(*m->motif)[portee])[tmp].note = note; } void definirOctave(Motif* m, int portee, int tmp, int octave){ (*(*m->motif)[portee])[tmp].octave = octave; } void definirInstrument(Motif* m, int portee, int tmp, int instrument){ (*(*m->motif)[portee])[tmp].instrument = instrument; } void definirVolume(Motif* m, int portee, int tmp, int volume){ (*(*m->motif)[portee])[tmp].volume = volume; } void definirEffet(Motif* m, int portee, int tmp, int effet){ (*(*m->motif)[portee])[tmp].effet = 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; }