diff --git a/sources/GUI/ponytrackertest.glade b/sources/GUI/ponytrackertest.glade old mode 100644 new mode 100755 index ba2ec9c..6dfc899 --- a/sources/GUI/ponytrackertest.glade +++ b/sources/GUI/ponytrackertest.glade @@ -943,6 +943,197 @@ + + False + + + True + False + vertical + + + True + False + True + 0 + 1 + + Choisir une note + Do + Do# + Re + Re# + Mi + Fa + Fa# + Sol + Sol# + La + La# + Si + + + + False + Choisir une note + + + + + False + True + 0 + + + + + True + False + True + 0 + + Choisir un octave + 1 + 2 + + + + False + Choisir un octave + + + + + False + True + 1 + + + + + True + False + True + 0 + 1 + + Choisir un instrument + 1 + 2 + 3 + 4 + 5 + + + + False + Choisir un instrument + + + + + False + True + 2 + + + + + True + False + True + 0 + 1 + + Choisir un volume + 1 + 2 + 3 + 4 + 5 + + + + False + Choisir un volume + + + + + False + True + 3 + + + + + True + False + True + 0 + 1 + + Choisir un effet + 1 + 2 + 3 + 4 + 5 + + + + False + Choisir un effet + + + + + False + True + 4 + + + + + True + False + + + OK + True + True + True + + + + False + True + 0 + + + + + Annuler + True + True + True + + + False + True + 1 + + + + + False + True + 6 + + + + + False @@ -1883,12 +2074,13 @@ True False - + Notes True True True 0.51999998092651367 + False @@ -2049,104 +2241,16 @@ + 300 True False - + + button True - False - - - True - False - True - 0 - 1 - - Do - - - - - False - - - - - - False - True - 1 - - - - - True - False - 0 - 1 - - 1 - 2 - - - - False - True - 2 - - - - - True - False - 0 - 1 - - 1 - 2 - - - - False - True - 2 - - - - - True - False - 0 - 1 - - 1 - 2 - - - - False - True - 4 - - - - - True - False - 0 - 1 - - 1 - 2 - - - - False - True - 4 - - + True + True + 0 @@ -2156,24 +2260,25 @@ - + + button True - False - - - - - - - - - - - - - - - + True + True + + + 1 + 0 + 1 + 1 + + + + + button + True + True + True 0 @@ -2183,24 +2288,25 @@ - + + button True - False - - - - - - - - - - - - - - - + True + True + + + 1 + 1 + 1 + 1 + + + + + button + True + True + True 0 @@ -2210,51 +2316,11 @@ - + + button True - False - - - - - - - - - - - - - - - - - - 0 - 5 - 1 - 1 - - - - - True - False - - - - - - - - - - - - - - - + True + True 0 @@ -2264,24 +2330,11 @@ - + + button True - False - - - - - - - - - - - - - - - + True + True 0 @@ -2291,256 +2344,1026 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + button + True + True + True + + + 0 + 5 + 1 + 1 + + + + + button + True + True + True + + + 0 + 7 + 1 + 1 + + + + + button + True + True + True + + + 0 + 6 + 1 + 1 + + + + + button + True + True + True + + + 0 + 8 + 1 + 1 + + + + + button + True + True + True + + + 0 + 9 + 1 + 1 + + + + + button + True + True + True + + + 0 + 10 + 1 + 1 + + + + + button + True + True + True + + + 0 + 11 + 1 + 1 + + + + + button + True + True + True + + + 0 + 12 + 1 + 1 + + + + + button + True + True + True + + + 0 + 13 + 1 + 1 + + + + + button + True + True + True + + + 0 + 14 + 1 + 1 + + + + + button + True + True + True + + + 0 + 15 + 1 + 1 + + + + + button + True + True + True + + + 1 + 2 + 1 + 1 + + + + + button + True + True + True + + + 1 + 3 + 1 + 1 + + + + + button + True + True + True + + + 1 + 4 + 1 + 1 + + + + + button + True + True + True + + + 1 + 5 + 1 + 1 + + + + + button + True + True + True + + + 1 + 6 + 1 + 1 + + + + + button + True + True + True + + + 1 + 7 + 1 + 1 + + + + + button + True + True + True + + + 1 + 8 + 1 + 1 + + + + + button + True + True + True + + + 1 + 9 + 1 + 1 + + + + + button + True + True + True + + + 1 + 10 + 1 + 1 + + + + + button + True + True + True + + + 1 + 11 + 1 + 1 + + + + + button + True + True + True + + + 1 + 12 + 1 + 1 + + + + + button + True + True + True + + + 1 + 13 + 1 + 1 + + + + + button + True + True + True + + + 1 + 14 + 1 + 1 + + + + + button + True + True + True + + + 1 + 15 + 1 + 1 + + + + + button + True + True + True + + + 2 + 0 + 1 + 1 + + + + + button + True + True + True + + + 3 + 0 + 1 + 1 + + + + + button + True + True + True + + + 2 + 1 + 1 + 1 + + + + + button + True + True + True + + + 3 + 1 + 1 + 1 + + + + + button + True + True + True + + + 2 + 2 + 1 + 1 + + + + + button + True + True + True + + + 3 + 2 + 1 + 1 + + + + + button + True + True + True + + + 2 + 3 + 1 + 1 + + + + + button + True + True + True + + + 3 + 3 + 1 + 1 + + + + + button + True + True + True + + + 2 + 4 + 1 + 1 + + + + + button + True + True + True + + + 3 + 4 + 1 + 1 + + + + + button + True + True + True + + + 2 + 5 + 1 + 1 + + + + + button + True + True + True + + + 3 + 5 + 1 + 1 + + + + + button + True + True + True + + + 2 + 6 + 1 + 1 + + + + + button + True + True + True + + + 3 + 6 + 1 + 1 + + + + + button + True + True + True + + + 2 + 7 + 1 + 1 + + + + + button + True + True + True + + + 3 + 7 + 1 + 1 + + + + + button + True + True + True + + + 2 + 8 + 1 + 1 + + + + + button + True + True + True + + + 2 + 9 + 1 + 1 + + + + + button + True + True + True + + + 2 + 10 + 1 + 1 + + + + + button + True + True + True + + + 2 + 11 + 1 + 1 + + + + + button + True + True + True + + + 2 + 12 + 1 + 1 + + + + + button + True + True + True + + + 2 + 13 + 1 + 1 + + + + + button + True + True + True + + + 2 + 14 + 1 + 1 + + + + + button + True + True + True + + + 2 + 15 + 1 + 1 + + + + + button + True + True + True + + + 3 + 8 + 1 + 1 + + + + + button + True + True + True + + + 3 + 9 + 1 + 1 + + + + + button + True + True + True + + + 3 + 10 + 1 + 1 + + + + + button + True + True + True + + + 3 + 11 + 1 + 1 + + + + + button + True + True + True + + + 3 + 12 + 1 + 1 + + + + + button + True + True + True + + + 3 + 13 + 1 + 1 + + + + + button + True + True + True + + + 3 + 14 + 1 + 1 + + + + + button + True + True + True + + + 3 + 15 + 1 + 1 + + + + + button + True + True + True + + + 4 + 0 + 1 + 1 + + + + + button + True + True + True + + + 4 + 1 + 1 + 1 + + + + + button + True + True + True + + + 4 + 2 + 1 + 1 + + + + + button + True + True + True + + + 4 + 3 + 1 + 1 + + + + + button + True + True + True + + + 4 + 4 + 1 + 1 + + + + + button + True + True + True + + + 4 + 5 + 1 + 1 + + + + + button + True + True + True + + + 4 + 6 + 1 + 1 + + + + + button + True + True + True + + + 4 + 7 + 1 + 1 + + + + + button + True + True + True + + + 4 + 8 + 1 + 1 + + + + + button + True + True + True + + + 4 + 9 + 1 + 1 + + + + + button + True + True + True + + + 4 + 10 + 1 + 1 + + + + + button + True + True + True + + + 4 + 11 + 1 + 1 + + + + + button + True + True + True + + + 4 + 12 + 1 + 1 + + + + + button + True + True + True + + + 4 + 13 + 1 + 1 + + + + + button + True + True + True + + + 4 + 14 + 1 + 1 + + + + + button + True + True + True + + + 4 + 15 + 1 + 1 + diff --git a/sources/lecture/lecture.c b/sources/lecture/lecture.c index 50ab4b7..e45da5d 100644 --- a/sources/lecture/lecture.c +++ b/sources/lecture/lecture.c @@ -112,7 +112,7 @@ void lecture (int nombreChaines, int nombreInst, int tempo, Instrument* inst[], //Lecture des motifs Motif* m; - + printf("\n"); for (int courant = 0; courant < taille; courant++) { for (int i = 0; i < melodie[courant] -> nbrTmp; i++) { diff --git a/sources/main.c b/sources/main.c index af5f4c9..8d0661d 100644 --- a/sources/main.c +++ b/sources/main.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "motifs/motifs.h" #include "melodie/melodie.h" @@ -41,6 +42,27 @@ Motif* melodie[MAX_PATTERNS] = {NULL}; Motif* liste = NULL; Instrument* inst[NBR_INST] = {NULL}; Sample* smpl[NBR_SMPL] = {NULL}; +int nbrPortees = 1; +int taille; + +GtkBuilder *monBuilder; +char *Do="Do"; +char *DoD="Do#"; +char *Re="Re"; +char *ReD="Re#"; +char *Mi="Mi"; +char *Fa="Fa"; +char *FaD="Fa#"; +char *Sol="Sol"; +char *SolD="Sol#"; +char *La="La"; +char *LaD="La#"; +char *Si="Si"; +char *N1="1"; +char *N2="2"; +char *N3="3"; +char *N4="4"; +char *N5="5"; // Fonctions de débug @@ -171,21 +193,144 @@ void debut(Motif* melodie[], Instrument* inst[], Sample* smpl[], Motif* liste, i } int main( int argc, char *argv[] ){ + debut(melodie, inst, smpl, liste, nbrPortees); + Motif* m = melodie[0]; + GtkWidget *maFenetre; + char str[20]; + gtk_init( &argc, &argv ); + + monBuilder = gtk_builder_new(); + + gtk_builder_add_from_file( monBuilder, "GUI/ponytrackertest.glade", NULL); + gtk_builder_connect_signals( monBuilder, NULL); + + maFenetre = GTK_WIDGET( gtk_builder_get_object( monBuilder, "fenetreprincipale")); + + GtkButton *button = (GtkButton*) gtk_builder_get_object(monBuilder, "button16"); + switch (getNote(m,0,0)) { + case 0 : + strcpy(str,"Do "); + break; + case 1 : + strcpy(str,"Do# "); + break; + case 2 : + strcpy(str,"Re "); + break; + case 3 : + strcpy(str,"Re# "); + break; + case 4 : + strcpy(str,"Mi "); + break; + case 5 : + strcpy(str,"Fa "); + break; + case 6 : + strcpy(str,"Fa# "); + break; + case 7 : + strcpy(str,"Sol "); + break; + case 8 : + strcpy(str,"Sol# "); + break; + case 9 : + strcpy(str,"La "); + break; + case 10 : + strcpy(str,"La# "); + break; + case 11 : + strcpy(str,"Si "); + break; + default : + break; + } - //lecture(nbrPortee, melodie); + printf("%d\n",getOctave(m,0,0)); + + switch (getOctave(m,0,0)) { + case 0 : + strcat(str, "0 "); + break; + case 1 : + strcat(str, "1 "); + break; + case 2 : + strcat(str, "2 "); + break; + case 3 : + strcat(str, "3 "); + break; + case 4 : + strcat(str, "4 "); + break; + default : + break; + } - // insérer code GTK ici - GtkBuilder *monBuilder; - GtkWidget *maFenetre; + switch (getInstrument(m,0,0)) { + case 0 : + strcat(str, "0 "); + break; + case 1 : + strcat(str, "1 "); + break; + case 2 : + strcat(str, "2 "); + break; + case 3 : + strcat(str, "3 "); + break; + case 4 : + strcat(str, "4 "); + break; + default : + break; + } - gtk_init( &argc, &argv ); + switch (getVolume(m,0,0)) { + case 0 : + strcat(str, "0 "); + break; + case 1 : + strcat(str, "1 "); + break; + case 2 : + strcat(str, "2 "); + break; + case 3 : + strcat(str, "3 "); + break; + case 4 : + strcat(str, "4 "); + break; + default : + break; + } - monBuilder = gtk_builder_new(); + switch (getEffet(m,0,0)) { + case 0 : + strcat(str, "0 "); + break; + case 1 : + strcat(str, "1 "); + break; + case 2 : + strcat(str, "2 "); + break; + case 3 : + strcat(str, "3 "); + break; + case 4 : + strcat(str, "4 "); + break; + default : + break; + } - 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_button_set_label(button, str); gtk_widget_show_all (maFenetre); gtk_main(); @@ -194,61 +339,121 @@ int main( int argc, char *argv[] ){ 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")); + GtkWidget *maFenetreSample = GTK_WIDGET( gtk_builder_get_object( monBuilder, "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")); + GtkWidget *maFenetreInstrument = GTK_WIDGET( gtk_builder_get_object( monBuilder, "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")); + GtkWidget *maFenetreMotif = GTK_WIDGET( gtk_builder_get_object( monBuilder, "ajoutmotif")); gtk_widget_show_all (maFenetreMotif); } +void fenetreNote ( int argc, char *argv[] ) +{ + GtkWidget *maFenetreNote = GTK_WIDGET( gtk_builder_get_object( monBuilder, "ajoutnote")); + + gtk_widget_show_all (maFenetreNote); +} + +void remplissageNote (GtkWidget *widget, gpointer *data){ + + Motif* m = melodie[0]; + + GtkEntry *entryNote = (GtkEntry*) gtk_builder_get_object(monBuilder,"combonote"); + GtkEntry *entryOctave = (GtkEntry*) gtk_builder_get_object(monBuilder,"combooctave"); + GtkEntry *entryInstrument = (GtkEntry*) gtk_builder_get_object(monBuilder,"comboinstrument"); + GtkEntry *entryVolume = (GtkEntry*) gtk_builder_get_object(monBuilder,"combovolume"); + GtkEntry *entryEffet = (GtkEntry*) gtk_builder_get_object(monBuilder,"comboeffet"); + + const char *strnote = gtk_entry_get_text(GTK_ENTRY(entryNote)); + const char *stroctave = gtk_entry_get_text(GTK_ENTRY(entryOctave)); + const char *strinstrument = gtk_entry_get_text(GTK_ENTRY(entryInstrument)); + const char *strvolume = gtk_entry_get_text(GTK_ENTRY(entryVolume)); + const char *streffet = gtk_entry_get_text(GTK_ENTRY(entryEffet)); + + if (strcmp(Do,strnote)==0) definirNote(m,0,0,1); + else + if (strcmp(DoD,strnote)==0) definirNote(m,0,0,2); + else + if (strcmp(Re,strnote)==0) definirNote(m,0,0,3); + else + if (strcmp(ReD,strnote)==0) definirNote(m,0,0,4); + else + if (strcmp(Mi,strnote)==0) definirNote(m,0,0,5); + else + if (strcmp(Fa,strnote)==0) definirNote(m,0,0,6); + else + if (strcmp(FaD,strnote)==0) definirNote(m,0,0,7); + else + if (strcmp(Sol,strnote)==0) definirNote(m,0,0,8); + else + if (strcmp(SolD,strnote)==0) definirNote(m,0,0,9); + else + if (strcmp(La,strnote)==0) definirNote(m,0,0,10); + else + if (strcmp(LaD,strnote)==0) definirNote(m,0,0,11); + else + if (strcmp(Si,strnote)==0) definirNote(m,0,0,12); + + if (strcmp(N1,stroctave)==0) definirOctave(m,0,0,1); + else + if (strcmp(N2,stroctave)==0) definirOctave(m,0,0,2); + else + if (strcmp(N3,stroctave)==0) definirOctave(m,0,0,3); + else + if (strcmp(N4,stroctave)==0) definirOctave(m,0,0,4); + else + if (strcmp(N5,stroctave)==0) definirOctave(m,0,0,5); + + if (strcmp(N1,strinstrument)==0) definirInstrument(m,0,0,1); + else + if (strcmp(N2,strinstrument)==0) definirInstrument(m,0,0,2); + else + if (strcmp(N3,strinstrument)==0) definirInstrument(m,0,0,3); + else + if (strcmp(N4,strinstrument)==0) definirInstrument(m,0,0,4); + else + if (strcmp(N5,strinstrument)==0) definirInstrument(m,0,0,5); + + if (strcmp(N1,strvolume)==0) definirVolume(m,0,0,1); + else + if (strcmp(N2,strvolume)==0) definirVolume(m,0,0,2); + else + if (strcmp(N3,strvolume)==0) definirVolume(m,0,0,3); + else + if (strcmp(N4,strvolume)==0) definirVolume(m,0,0,4); + else + if (strcmp(N5,strvolume)==0) definirVolume(m,0,0,5); + + if (strcmp(N1,streffet)==0) definirEffet(m,0,0,1); + else + if (strcmp(N2,streffet)==0) definirEffet(m,0,0,2); + else + if (strcmp(N3,streffet)==0) definirEffet(m,0,0,3); + else + if (strcmp(N4,streffet)==0) definirEffet(m,0,0,4); + else + if (strcmp(N5,streffet)==0) definirEffet(m,0,0,5); +} + void lancerLecture () { - int nbrPortees = 1; + //courant = 0; - taille = 0; - debut(melodie, inst, smpl, liste, nbrPortees); + //taille = 0; + printf("%d\n",nbrPortees); + //debut(melodie, inst, smpl, liste, nbrPortees); lecture(nbrPortees,1,480,inst,melodie); } @@ -256,3 +461,5 @@ void quitter () { gtk_main_quit(); } + +void refresh(){}