126 lines
3.0 KiB
C
126 lines
3.0 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "motifs/motifs.h"
|
|
#include "melodie/melodie.h"
|
|
#include "lecture/lecture.h"
|
|
#include "/opt/local/include/SDL/SDL.h"
|
|
#include "/opt/local/include/SDL/SDL_mixer.h"
|
|
|
|
#define DEF_NBR_TMP 16
|
|
#define MAX_PATTERNS 256
|
|
|
|
// Fonctions de débug
|
|
|
|
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("%d ",getNote(m,portee,tmp));
|
|
}
|
|
printf("\n");
|
|
}
|
|
}
|
|
|
|
// Fin des fonctions de débug
|
|
|
|
void debut(Motif* melodie[], Motif* liste, int nbrPortees){
|
|
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
|
Motif* m = liste;
|
|
definirNote(m,0,4,5);
|
|
definirNote(m,1,2,9);
|
|
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
|
Motif* n = liste;
|
|
definirNote(n,0,10,3);
|
|
definirNote(n,1,6,7);
|
|
ajouterMotifVirtuel(melodie,0,m);
|
|
ajouterMotifVirtuel(melodie,1,n);
|
|
ajouterMotifVirtuel(melodie,2,m);
|
|
ajouterMotifVirtuel(melodie,3,n);
|
|
}
|
|
|
|
/*void lecture ()
|
|
{
|
|
gtk_main_quit();
|
|
}*/
|
|
|
|
int main( int argc, char *argv[] ){
|
|
Motif* melodie[MAX_PATTERNS] = {NULL};
|
|
Motif* liste = NULL;
|
|
int nbrPortees = 2;
|
|
courant = 0;
|
|
taille = 0;
|
|
|
|
debut(melodie, liste, nbrPortees);
|
|
//lecture(nbrPortee, melodie);
|
|
|
|
// insérer code GTK ici
|
|
GtkBuilder *monBuilder;
|
|
GtkWidget *maFenetre;
|
|
|
|
gtk_init( &argc, &argv );
|
|
|
|
monBuilder = gtk_builder_new();
|
|
|
|
gtk_builder_add_from_file( monBuilder, "GUI/ponytracker.glade", NULL);
|
|
gtk_builder_connect_signals( monBuilder, NULL);
|
|
|
|
maFenetre = GTK_WIDGET( gtk_builder_get_object( monBuilder, "fenetrePrincipale"));
|
|
|
|
gtk_widget_show_all (maFenetre);
|
|
gtk_main();
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
void fenetreSample ( int argc, char *argv[] )
|
|
{
|
|
GtkBuilder *monBuilderSample;
|
|
GtkWidget *maFenetreSample;
|
|
|
|
gtk_init( &argc, &argv );
|
|
|
|
monBuilderSample = gtk_builder_new();
|
|
|
|
gtk_builder_add_from_file( monBuilderSample, "GUI/ponytracker.glade", NULL);
|
|
gtk_builder_connect_signals( monBuilderSample, NULL);
|
|
|
|
maFenetreSample = GTK_WIDGET( gtk_builder_get_object( monBuilderSample, "ajoutSample"));
|
|
|
|
gtk_widget_show_all (maFenetreSample);
|
|
}
|
|
|
|
void fenetreInstrument ( int argc, char *argv[] )
|
|
{
|
|
GtkBuilder *monBuilderInstrument;
|
|
GtkWidget *maFenetreInstrument;
|
|
|
|
gtk_init( &argc, &argv );
|
|
|
|
monBuilderInstrument = gtk_builder_new();
|
|
|
|
gtk_builder_add_from_file( monBuilderInstrument, "GUI/ponytracker.glade", NULL);
|
|
gtk_builder_connect_signals( monBuilderInstrument, NULL);
|
|
|
|
maFenetreInstrument = GTK_WIDGET( gtk_builder_get_object( monBuilderInstrument, "ajoutInstrument"));
|
|
|
|
gtk_widget_show_all (maFenetreInstrument);
|
|
}
|
|
|
|
void fenetreMotif ( int argc, char *argv[] )
|
|
{
|
|
GtkBuilder *monBuilderMotif;
|
|
GtkWidget *maFenetreMotif;
|
|
|
|
gtk_init( &argc, &argv );
|
|
|
|
monBuilderMotif = gtk_builder_new();
|
|
|
|
gtk_builder_add_from_file( monBuilderMotif, "GUI/ponytracker.glade", NULL);
|
|
gtk_builder_connect_signals( monBuilderMotif, NULL);
|
|
|
|
maFenetreMotif = GTK_WIDGET( gtk_builder_get_object( monBuilderMotif, "ajoutMotif"));
|
|
|
|
gtk_widget_show_all (maFenetreMotif);
|
|
}
|