#include <stdio.h>
#include <stdlib.h>
#include "../lecture/lecture.h"

#define DEF_NBR_TMP 16
#define MAX_PATTERNS 256

void afficherMotif(Motif* m, int nbrPortees){
	printf("%s  :\n",m->nom);
	for (int tmp = 0; tmp < m->nbrTmp; tmp++){
		for (int portee = 0; portee < nbrPortees; portee++){
			printf("N=%d I=%d",getNote(m,portee,tmp),getInstrument(m,portee,tmp));
		}
		printf("\n");
	}
}

void debut(Motif* melodie[], Motif* liste, int nbrPortees){
	ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
	Motif* m = liste;
	definirNote(m,0,4,5);
	definirNote(m,0,2,9);
	ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
	Motif* n = liste;
	definirNote(n,0,10,3);
	definirNote(n,0,6,7);
	ajouterMotifVirtuel(melodie,0,m);
	ajouterMotifVirtuel(melodie,1,n);
	ajouterMotifVirtuel(melodie,2,m);
	ajouterMotifVirtuel(melodie,3,n);
}


int main(){
	Motif* melodie[MAX_PATTERNS] = {NULL};
	Motif* liste = NULL;
	int nbrPortees = 1;
	courant = 0;
	taille = 0;
	debut(melodie, liste, nbrPortees);
	for (int i = 0; i < taille; i++) {
		afficherMotif(melodie[i], nbrPortees);
	}
	lecture(nbrPortees,melodie);
}
