Commit important : maintenant, y a des trucs qui marchent :)
This commit is contained in:
parent
33e4ec7e4a
commit
9a8c5c711a
|
@ -21,4 +21,8 @@ sources/motifs/motifs.o
|
|||
sources/melodie/melodie.o
|
||||
sources/.main.c.swp
|
||||
sources/melodie/.melodie.c.swp
|
||||
sources/melodie/.melodie.h.swp
|
||||
sources/melodie/.melodie.h.swp
|
||||
sources/main.o
|
||||
sources/melodie.o
|
||||
sources/motifs.o
|
||||
sources/ponytracker
|
|
@ -7,7 +7,7 @@ main.o : main.c
|
|||
motifs.o : motifs/motifs.c motifs/motifs.h
|
||||
gcc -Wall -c motifs/motifs.c
|
||||
|
||||
melodie.o : motifs/melodie.c motifs/melodie.h
|
||||
melodie.o : melodie/melodie.c melodie/melodie.h
|
||||
gcc -Wall -c melodie/melodie.c
|
||||
|
||||
clean :
|
||||
|
|
|
@ -5,9 +5,32 @@
|
|||
#include "melodie/melodie.h"
|
||||
|
||||
#define DEF_NBR_TMP 16
|
||||
#define MAX_PATTERNS 256
|
||||
|
||||
// Les fonctions de ce fichiers autres que main sont des fonction de débug.
|
||||
|
||||
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);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
Motif* melodie[MAX_PATTERNS] = {NULL};
|
||||
Motif* liste = NULL;
|
||||
int nbrPortees = 4;
|
||||
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;
|
||||
ajouterMotifVirtuel(melodie,0,m);
|
||||
afficherMotif(m,nbrPortees);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include <stdio.h>
|
||||
#include "../motifs/motifs.h"
|
||||
|
||||
int courant = 0;
|
||||
int courant;
|
||||
|
||||
int taille = 0;
|
||||
int taille;
|
||||
|
||||
// Les trois fonctions suivantes servent au couplage avec la GUI.
|
||||
|
||||
|
|
|
@ -9,29 +9,30 @@ int getIdMotif(Motif* m){
|
|||
}
|
||||
}
|
||||
|
||||
void ajouterMotif(Motif* liste, int nbrTmp, int nbrPortees){
|
||||
void ajouterMotif(Motif** pliste, int nbrTmp, int nbrPortees){
|
||||
Motif* m = malloc(sizeof(Motif));
|
||||
m->nbrTmp = DEFNBRTMP;
|
||||
m->suivant = liste;
|
||||
m->motif = malloc(nbrPortees*sizeof(Portee));
|
||||
char* nombre = NULL;
|
||||
m->suivant = *pliste;
|
||||
m->motif = malloc(nbrPortees*sizeof(Portee*));
|
||||
strcpy(m->nom,"Motif ");
|
||||
char nombre[10];
|
||||
sprintf(nombre,"%d",getIdMotif(m));
|
||||
m->nom = strcat("Motif ", nombre);
|
||||
strcat(m->nom, nombre);
|
||||
int i;
|
||||
for (i=0; i<nbrPortees; i++) {
|
||||
m->motif[i] = calloc(DEFNBRTMP,sizeof(Note));
|
||||
(*m->motif)[i] = calloc(DEFNBRTMP,sizeof(Note));
|
||||
}
|
||||
liste = m;
|
||||
*pliste = m;
|
||||
}
|
||||
|
||||
void definirNomMotif(Motif* m, char* nom){
|
||||
m->nom = nom;
|
||||
strcpy(m->nom,nom);
|
||||
}
|
||||
|
||||
void supprimerMotif(Motif** cellule, int nbrPortees){
|
||||
int i;
|
||||
for (i=0; i<nbrPortees; i++) {
|
||||
free((*cellule)->motif[i]);
|
||||
free((*((*cellule)->motif))[i]);
|
||||
}
|
||||
free((*cellule)->motif);
|
||||
Motif* aux = (*cellule)->suivant;
|
||||
|
@ -40,25 +41,25 @@ void supprimerMotif(Motif** cellule, int nbrPortees){
|
|||
}
|
||||
|
||||
void definirNote(Motif* m, int portee, int tmp, int note){
|
||||
m->motif[portee][tmp]->note = note;
|
||||
(*(*m->motif)[portee])[tmp].note = note;
|
||||
}
|
||||
|
||||
void definirOctave(Motif* m, int portee, int tmp, int octave){
|
||||
m->motif[portee][tmp]->octave = octave;
|
||||
(*(*m->motif)[portee])[tmp].octave = octave;
|
||||
}
|
||||
|
||||
void definirInstrument(Motif* m, int portee, int tmp, int instrument){
|
||||
m->motif[portee][tmp]->instrument = instrument;
|
||||
(*(*m->motif)[portee])[tmp].instrument = instrument;
|
||||
}
|
||||
|
||||
void definirVolume(Motif* m, int portee, int tmp, int volume){
|
||||
m->motif[portee][tmp]->volume = volume;
|
||||
(*(*m->motif)[portee])[tmp].volume = volume;
|
||||
}
|
||||
|
||||
void definirEffet(Motif* m, int portee, int tmp, int effet){
|
||||
m->motif[portee][tmp]->effet = effet;
|
||||
(*(*m->motif)[portee])[tmp].effet = effet;
|
||||
}
|
||||
|
||||
void supprimerNote(Motif* m, int portee, int tmp){
|
||||
m->motif[portee][tmp]->note = 0;
|
||||
(*(*m->motif)[portee])[tmp].note = 0;
|
||||
}
|
||||
|
|
|
@ -14,18 +14,20 @@ typedef struct _note{
|
|||
int effet;
|
||||
} Note;
|
||||
|
||||
typedef Note** Portee;
|
||||
typedef Note Portee[];
|
||||
|
||||
typedef Portee* Mesure[];
|
||||
|
||||
typedef struct _motif{
|
||||
char* nom;
|
||||
char nom[10];
|
||||
int nbrTmp;
|
||||
Portee* motif;
|
||||
Mesure* motif;
|
||||
struct _motif* suivant;
|
||||
} Motif;
|
||||
|
||||
int getIdMotif(Motif* m);
|
||||
|
||||
void ajouterMotif(Motif* liste, int nbrTmp, int nbrPortees);
|
||||
void ajouterMotif(Motif** pliste, int nbrTmp, int nbrPortees);
|
||||
|
||||
void definirNomMotif(Motif* m, char* nom);
|
||||
|
||||
|
|
Loading…
Reference in New Issue