ponytracker/sources/main.c

126 lines
3.0 KiB
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
2014-04-08 18:30:56 +02:00
#include <gtk/gtk.h>
#include "motifs/motifs.h"
#include "melodie/melodie.h"
#include "lecture/lecture.h"
#include <SDL2/SDL.h>
#include <SDL2/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,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);
}
2014-04-08 18:30:56 +02:00
int main( int argc, char *argv[] ){
2014-04-08 18:30:56 +02:00
//lecture(nbrPortee, melodie);
// insérer code GTK ici
2014-04-08 18:30:56 +02:00
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);
2014-04-08 18:30:56 +02:00
maFenetre = GTK_WIDGET( gtk_builder_get_object( monBuilder, "fenetrePrincipale"));
gtk_widget_show_all (maFenetre);
gtk_main();
return EXIT_SUCCESS;
}
2014-04-08 18:30:56 +02:00
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);
}
void lancerLecture ()
{
Motif* melodie[MAX_PATTERNS] = {NULL};
Motif* liste = NULL;
int nbrPortees = 1;
courant = 0;
taille = 0;
debut(melodie, liste, nbrPortees);
//lecture(nbrPortees,melodie);*/
}