Merge branch 'master' of ssh://abwabwa.org:55555/home/git/ponytracker
This commit is contained in:
commit
c08705dcb9
|
@ -0,0 +1,41 @@
|
|||
#include "FX.h"
|
||||
|
||||
|
||||
// Ces fonctions prennent en entrée une chaine et de nombreux paramètres, on pourrait afficher une petite fenêtre dédiée
|
||||
// à l'effet ajouté pour proposer de les entrer/modifier de façon plus intelligible.
|
||||
|
||||
|
||||
void fxChorus (FMOD_CHANNEL *chan, int dry, int wet1, int wet2, int wet3, int delay, int rate, int depth) {
|
||||
|
||||
FMOD_DSP *chorus;
|
||||
|
||||
FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_CHORUS, &chorus);
|
||||
|
||||
FMOD_DSP_SetParameter(chorus, FMOD_DSP_CHORUS_DRYMIX, dry); // dry correspond au volume du signal d'origine (de 0.0 à 1.0)
|
||||
FMOD_DSP_SetParameter(chorus, FMOD_DSP_CHORUS_WETMIX1, wet1); // wet1 correspond au volume du premier echo du chorus (de 0.0 à 1.0)
|
||||
FMOD_DSP_SetParameter(chorus, FMOD_DSP_CHORUS_WETMIX2, wet2); // idem pour le 2e echo
|
||||
FMOD_DSP_SetParameter(chorus, FMOD_DSP_CHORUS_WETMIX3, wet3); // idem pour le 3e echo
|
||||
FMOD_DSP_SetParameter(chorus, FMOD_DSP_CHORUS_DELAY, delay); // le retard de l'echo en millisecondes (de 0.1 à 100.0)
|
||||
FMOD_DSP_SetParameter(chorus, FMOD_DSP_CHORUS_RATE, rate); // la vitesse de modulation en Hz (de 0.0 à 20.0)
|
||||
FMOD_DSP_SetParameter(chorus, FMOD_DSP_CHORUS_DEPTH, depth); // la profondeur du chorus de 0.0 à 1.0
|
||||
|
||||
FMOD_Channel_AddDSP(chan, chorus, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void fxDelay (FMOD_CHANNEL *chan, int dry, int wet, int time, int decay) {
|
||||
|
||||
FMOD_DSP *delay;
|
||||
|
||||
FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_ECHO, &delay);
|
||||
|
||||
FMOD_DSP_SetParameter(delay, FMOD_DSP_ECHO_DRYMIX, dry); // dry correspond au volume du signal d'origine (de 0.0 à 1.0)
|
||||
FMOD_DSP_SetParameter(delay, FMOD_DSP_ECHO_WETMIX, wet); // wet correspond au volume de l'effet (de 0.0 à 1.0)
|
||||
FMOD_DSP_SetParameter(delay, FMOD_DSP_ECHO_DELAY, time); // time donne le temps entre chaque echo en millisecondes (de 1 à 5000)
|
||||
FMOD_DSP_SetParameter(delay, FMOD_DSP_ECHO_DECAYRATIO, decay); // decay donne la vitesse d'atténuation de l'echo (qui baisse à chaque répétition) (de 0.0 pour une atténuation totale après le premier echo à 1.0 pour des echo infinis)
|
||||
|
||||
FMOD_Channel_AddDSP(chan, delay, 0);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _FX_h
|
||||
#define _FX_h
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fmodex/fmod.h>
|
||||
|
||||
|
||||
void fxChorus (FMOD_CHANNEL *chan, int dry, int wet1, int wet2, int wet3, int delay, int rate, int depth) {
|
||||
}
|
||||
|
||||
void fxDelay (FMOD_CHANNEL *chan, int dry, int wet, int time, int decay) {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#include "VolPan.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void pan (int position, FMOD_CHANNEL *chan) { // La fonction prend en entrée un entier entre -1 (son à gauche) et 1 (son à droite)
|
||||
FMOD_Channel_SetPan(chan, position); // et la chaine FMOD à affecter
|
||||
}
|
||||
|
||||
void vol (int volume, FMOD_CHANNEL *chan) { // La fonction prend en entrée un entier entre 0 (-inf dB) et 1 (0 dB)
|
||||
FMOD_Channel_SetVolume(chan, volume); // et la chaine FMOD à affecter
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _VolPan_h
|
||||
#define _VolPan_h
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fmodex/fmod.h>
|
||||
|
||||
|
||||
void pan (int position, FMOD_CHANNEL *chan) {
|
||||
}
|
||||
|
||||
void vol (int volume, FMOD_CHANNEL *chan) {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
all : ponytracker clean
|
||||
|
||||
ponytracker : maintest.o lecture.o motifs.o melodie.o
|
||||
gcc -std=c99 -L'fmod/lib' -lfmodex64 -Wall maintest.o lecture.o motifs.o melodie.o -o ponytracker `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
|
||||
|
||||
maintest.o : maintest.c
|
||||
gcc -std=c99 -Wall -c maintest.c `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
|
||||
|
||||
motifs.o : motifs/motifs.c motifs/motifs.h
|
||||
gcc -std=c99 -Wall -c motifs/motifs.c
|
||||
|
||||
melodie.o : melodie/melodie.c melodie/melodie.h
|
||||
gcc -std=c99 -Wall -c melodie/melodie.c
|
||||
|
||||
lecture.o : lecture/lecture.c lecture/lecture.h
|
||||
gcc -std=c99 -Wall -c lecture/lecture.c
|
||||
|
||||
clean :
|
||||
rm -f *.o
|
|
@ -0,0 +1,295 @@
|
|||
/**
|
||||
* \mainpage CSC3502 : PonyTracker
|
||||
*
|
||||
* Les fonctionnalités de cette application sont les suivantes :
|
||||
* <ul>
|
||||
* <li> fonction 1</li>
|
||||
* <li> fonction 2</li>
|
||||
* <li> fonction 3</li>
|
||||
* <li> fonction 4</li>
|
||||
* </ul>
|
||||
*
|
||||
* @file main.c
|
||||
*
|
||||
* Programme principal du Ponytracker
|
||||
*
|
||||
* @version 1.1
|
||||
* @author Module CSC3502 : Projet Informatique 1ère année TELECOM SudParis
|
||||
* @date Mai 2014
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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>
|
||||
//#include <SDL2/SDL_main.h>
|
||||
|
||||
#define DEF_NBR_TMP 16
|
||||
#define MAX_PATTERNS 256
|
||||
|
||||
Motif* m;
|
||||
|
||||
void remplissageNote (GtkWidget *widget, gpointer *data);
|
||||
|
||||
// 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;
|
||||
|
||||
// My Little Pony.
|
||||
definirNote(m,0,0,1);
|
||||
definirInstrument(m,0,0,1);
|
||||
definirInstrument(m,0,2,-1);
|
||||
definirNote(m,0,4,1);
|
||||
definirInstrument(m,0,4,0);
|
||||
definirNote(m,0,5,1);
|
||||
definirInstrument(m,0,5,1);
|
||||
definirInstrument(m,0,6,-1);
|
||||
definirNote(m,0,7,1);
|
||||
definirInstrument(m,0,7,2);
|
||||
definirInstrument(m,0,8,-1);
|
||||
definirNote(m,0,9,1);
|
||||
definirInstrument(m,0,9,1);
|
||||
definirInstrument(m,0,12,-1);
|
||||
|
||||
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
||||
Motif* n = liste;
|
||||
|
||||
// I used to wonder what friendship could be.
|
||||
definirNote(n,0,1,1);
|
||||
definirInstrument(n,0,1,3);
|
||||
definirNote(n,0,2,1);
|
||||
definirInstrument(n,0,2,3);
|
||||
definirNote(n,0,3,1);
|
||||
definirInstrument(n,0,3,3);
|
||||
definirNote(n,0,4,1);
|
||||
definirInstrument(n,0,4,3);
|
||||
definirInstrument(n,0,5,-1);
|
||||
definirNote(n,0,6,1);
|
||||
definirInstrument(n,0,6,1);
|
||||
definirNote(n,0,7,1);
|
||||
definirInstrument(n,0,7,2);
|
||||
definirInstrument(n,0,8,-1);
|
||||
definirNote(n,0,9,1);
|
||||
definirInstrument(n,0,9,1);
|
||||
definirInstrument(n,0,10,-1);
|
||||
definirNote(n,0,11,1);
|
||||
definirInstrument(n,0,11,3);
|
||||
definirInstrument(n,0,12,-1);
|
||||
definirNote(n,0,13,1);
|
||||
definirInstrument(n,0,13,2);
|
||||
definirInstrument(n,0,14,-1);
|
||||
definirNote(n,0,15,1);
|
||||
definirInstrument(n,0,15,1);
|
||||
|
||||
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
||||
Motif* p = liste;
|
||||
|
||||
// Until you all shared its magic with me.
|
||||
definirNote(p,0,0,1);
|
||||
definirInstrument(p,0,0,3);
|
||||
definirNote(p,0,1,1);
|
||||
definirInstrument(p,0,1,4);
|
||||
definirInstrument(p,0,2,-1);
|
||||
definirNote(p,0,3,1);
|
||||
definirInstrument(p,0,3,4);
|
||||
definirInstrument(p,0,4,-1);
|
||||
definirNote(p,0,5,1);
|
||||
definirInstrument(p,0,5,3);
|
||||
definirInstrument(p,0,6,-1);
|
||||
definirNote(p,0,7,1);
|
||||
definirInstrument(p,0,7,2);
|
||||
definirInstrument(p,0,8,-1);
|
||||
definirNote(p,0,9,1);
|
||||
definirInstrument(p,0,9,1);
|
||||
definirNote(p,0,10,1);
|
||||
definirInstrument(p,0,10,3);
|
||||
definirInstrument(p,0,11,-1);
|
||||
definirNote(p,0,12,1);
|
||||
definirInstrument(p,0,12,2);
|
||||
definirInstrument(p,0,14,-1);
|
||||
|
||||
ajouterMotifVirtuel(melodie,0,m);
|
||||
ajouterMotifVirtuel(melodie,1,n);
|
||||
ajouterMotifVirtuel(melodie,2,m);
|
||||
ajouterMotifVirtuel(melodie,3,p);
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] ){
|
||||
|
||||
//lecture(nbrPortee, melodie);
|
||||
|
||||
// insérer code GTK ici
|
||||
GtkBuilder *monBuilder;
|
||||
GtkWidget *maFenetre;
|
||||
char *str;
|
||||
|
||||
gtk_init( &argc, &argv );
|
||||
|
||||
monBuilder = gtk_builder_new();
|
||||
|
||||
gtk_builder_add_from_file( monBuilder, "ponytrackertest.glade", NULL);
|
||||
gtk_builder_connect_signals( monBuilder, NULL);
|
||||
|
||||
maFenetre = GTK_WIDGET( gtk_builder_get_object( monBuilder, "fenetreprincipale"));
|
||||
|
||||
GtkLabel *labelNote = (GtkLabel*) gtk_builder_get_object(monBuilder,"button16");
|
||||
if (getNote(m,0,0)==0) str="Do";
|
||||
else if (getNote(m,0,0)==1) str="Re";
|
||||
gtk_label_set_text(labelNote, str);
|
||||
|
||||
gtk_widget_show_all (maFenetre);
|
||||
gtk_main();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void remplissageNote (GtkWidget *widget, gpointer *data){
|
||||
char *Do="Do";
|
||||
char *Re="Re";
|
||||
char *Mi="Mi";
|
||||
char *N1="1";
|
||||
char *N2="2";
|
||||
|
||||
GtkBuilder *monBuilderNote;
|
||||
|
||||
monBuilderNote = gtk_builder_new();
|
||||
|
||||
gtk_builder_add_from_file( monBuilderNote, "ponytrackertest.glade", NULL);
|
||||
gtk_builder_connect_signals( monBuilderNote, NULL);
|
||||
|
||||
GtkEntry *entryNote = (GtkEntry*) gtk_builder_get_object(monBuilderNote,"choisirnote");
|
||||
GtkEntry *entryOctave = (GtkEntry*) gtk_builder_get_object(monBuilderNote,"choisiroctave");
|
||||
GtkEntry *entryInstrument = (GtkEntry*) gtk_builder_get_object(monBuilderNote,"choisirinstrument");
|
||||
GtkEntry *entryVolume = (GtkEntry*) gtk_builder_get_object(monBuilderNote,"entryvolume");
|
||||
GtkEntry *entryEffet = (GtkEntry*) gtk_builder_get_object(monBuilderNote,"entryeffet");
|
||||
|
||||
if (strcmp(Do,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,1);
|
||||
else
|
||||
if (strcmp(Re,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,2);
|
||||
else
|
||||
if (strcmp(Mi,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,3);
|
||||
|
||||
if (strcmp(N1,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,1);
|
||||
else
|
||||
if (strcmp(N2,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,2);
|
||||
|
||||
if (strcmp(N1,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,1);
|
||||
else
|
||||
if (strcmp(N2,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,2);
|
||||
|
||||
if (strcmp(N1,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,1);
|
||||
else
|
||||
if (strcmp(N2,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,2);
|
||||
|
||||
if (strcmp(N1,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,1);
|
||||
else
|
||||
if (strcmp(N2,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,2);
|
||||
}
|
||||
|
||||
void fenetreSample ( int argc, char *argv[] )
|
||||
{
|
||||
GtkBuilder *monBuilderSample;
|
||||
GtkWidget *maFenetreSample;
|
||||
|
||||
gtk_init( &argc, &argv );
|
||||
|
||||
monBuilderSample = gtk_builder_new();
|
||||
|
||||
gtk_builder_add_from_file( monBuilderSample, "ponytrackertest.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, "ponytrackertest.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, "ponytrackertest.glade", NULL);
|
||||
gtk_builder_connect_signals( monBuilderMotif, NULL);
|
||||
|
||||
maFenetreMotif = GTK_WIDGET( gtk_builder_get_object( monBuilderMotif, "ajoutmotif"));
|
||||
|
||||
gtk_widget_show_all (maFenetreMotif);
|
||||
}
|
||||
|
||||
void fenetreNote ( int argc, char *argv[] )
|
||||
{
|
||||
GtkBuilder *monBuilderNote;
|
||||
GtkWidget *maFenetreNote;
|
||||
|
||||
gtk_init( &argc, &argv );
|
||||
|
||||
monBuilderNote = gtk_builder_new();
|
||||
|
||||
gtk_builder_add_from_file( monBuilderNote, "ponytrackertest.glade", NULL);
|
||||
gtk_builder_connect_signals( monBuilderNote, NULL);
|
||||
|
||||
maFenetreNote = GTK_WIDGET( gtk_builder_get_object( monBuilderNote, "ajoutnote"));
|
||||
|
||||
GtkButton *button = (GtkButton*) gtk_builder_get_object(monBuilderNote, "buttonok");
|
||||
|
||||
g_signal_connect(G_OBJECT(button),"changed",G_CALLBACK(remplissageNote),
|
||||
GTK_WIDGET( gtk_builder_get_object( monBuilderNote, "ajoutnote")));
|
||||
|
||||
gtk_widget_show_all (maFenetreNote);
|
||||
}
|
||||
|
||||
void lancerLecture ()
|
||||
{
|
||||
Motif* melodie[MAX_PATTERNS] = {NULL};
|
||||
Motif* liste = NULL;
|
||||
int nbrPortees = 1;
|
||||
courant = 0;
|
||||
taille = 0;
|
||||
debut(melodie, liste, nbrPortees);
|
||||
lecture(nbrPortees,480,melodie);
|
||||
}
|
||||
|
||||
void quitter ()
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue