Merge branch 'master' of ssh://abwabwa.org:55555/home/git/ponytracker
Conflicts: sources/mainTest/maintest.c
This commit is contained in:
commit
d4cc3aea2a
|
@ -41,3 +41,4 @@ sources/instruments/.instruments.c.swp
|
||||||
sources/instruments/instruments.o
|
sources/instruments/instruments.o
|
||||||
sources/samples/.samples.c.swp
|
sources/samples/.samples.c.swp
|
||||||
sources/samples/samples.o
|
sources/samples/samples.o
|
||||||
|
sources/mainTest/.maintest.c.swp
|
|
@ -1,7 +1,7 @@
|
||||||
all : ponytracker clean
|
all : ponytracker clean
|
||||||
|
|
||||||
ponytracker : main.o lecture.o motifs.o melodie.o
|
ponytracker : main.o lecture.o motifs.o melodie.o samples.o instruments.o
|
||||||
gcc -std=c99 -L'fmod/lib' -lfmodex -Wall main.o lecture.o motifs.o melodie.o -o ponytracker `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
|
gcc -std=c99 -L'fmod/lib' -lfmodex -Wall main.o lecture.o motifs.o melodie.o instruments.o samples.o -o ponytracker `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
|
||||||
|
|
||||||
main.o : main.c
|
main.o : main.c
|
||||||
gcc -std=c99 -Wall -c main.c `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
|
gcc -std=c99 -Wall -c main.c `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
|
||||||
|
@ -15,5 +15,11 @@ melodie.o : melodie/melodie.c melodie/melodie.h
|
||||||
lecture.o : lecture/lecture.c lecture/lecture.h
|
lecture.o : lecture/lecture.c lecture/lecture.h
|
||||||
gcc -std=c99 -Wall -c lecture/lecture.c
|
gcc -std=c99 -Wall -c lecture/lecture.c
|
||||||
|
|
||||||
|
samples.o : samples/samples.c samples/samples.h
|
||||||
|
gcc -std=c99 -Wall -c samples/samples.c
|
||||||
|
|
||||||
|
instruments.o : instruments/instruments.c instruments/instruments.h
|
||||||
|
gcc -std=c99 -Wall -c instruments/instruments.c
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
|
|
|
@ -19,7 +19,11 @@ void supprimerInstrument(Instrument* tab[], int i){
|
||||||
free(tab[i]);
|
free(tab[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getVolume(Instrument* inst) {
|
char* getChemin(Instrument* inst) {
|
||||||
|
return inst->sample->chemin;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getVolumeInst(Instrument* inst) {
|
||||||
return inst->volume;
|
return inst->volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,11 +34,16 @@ int getBalance(Instrument* inst) {
|
||||||
char* getNomInst(Instrument* inst) {
|
char* getNomInst(Instrument* inst) {
|
||||||
return inst->nom;
|
return inst->nom;
|
||||||
}
|
}
|
||||||
void setVolume(Instrument* inst, int volume) {
|
|
||||||
|
Sample* getSample(Instrument* inst) {
|
||||||
|
return inst->sample;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setVolumeInst(Instrument* inst, int volume) {
|
||||||
inst->volume = volume;
|
inst->volume = volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBalance(Instrument* inst, int balance) {
|
void setBalanceInst(Instrument* inst, int balance) {
|
||||||
inst->balance = balance;
|
inst->balance = balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +51,10 @@ void setNomInst(Instrument* inst, char* nom) {
|
||||||
strcpy(inst->nom,nom);
|
strcpy(inst->nom,nom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSample(Instrument* inst, Sample* smpl){
|
||||||
|
inst->sample = smpl;
|
||||||
|
}
|
||||||
|
|
||||||
float rapportPitch(Instrument* inst, int note, int octave){
|
float rapportPitch(Instrument* inst, int note, int octave){
|
||||||
float freq = 440*pow(2,(octave-3)+(note-11)*(1.0/12.0));
|
float freq = 440*pow(2,(octave-3)+(note-11)*(1.0/12.0));
|
||||||
return freq/(inst->sample->hauteur_ref);
|
return freq/(inst->sample->hauteur_ref);
|
||||||
|
|
|
@ -36,18 +36,24 @@ void ajouterInstrument(Instrument* tab[], int i);
|
||||||
|
|
||||||
void supprimerInstrument(Instrument* tab[], int i);
|
void supprimerInstrument(Instrument* tab[], int i);
|
||||||
|
|
||||||
int getVolume(Instrument* inst);
|
char* getChemin(Instrument* inst);
|
||||||
|
|
||||||
int getBalance(Instrument* inst);
|
int getVolumeInst(Instrument* inst);
|
||||||
|
|
||||||
|
int getBalanceInst(Instrument* inst);
|
||||||
|
|
||||||
char* getNomInst(Instrument* inst);
|
char* getNomInst(Instrument* inst);
|
||||||
|
|
||||||
|
Sample* getSample(Instrument* inst);
|
||||||
|
|
||||||
void setVolume(Instrument* inst, int volume);
|
void setVolume(Instrument* inst, int volume);
|
||||||
|
|
||||||
void setBalance(Instrument* inst, int balance);
|
void setBalance(Instrument* inst, int balance);
|
||||||
|
|
||||||
void setNomInst(Instrument* inst, char* nom);
|
void setNomInst(Instrument* inst, char* nom);
|
||||||
|
|
||||||
|
void setSample(Instrument* inst, Sample* smpl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cette fonction prend une note et une octave en paramètre et renvoie la valeur à entrer dans le pitch shifter.
|
* Cette fonction prend une note et une octave en paramètre et renvoie la valeur à entrer dans le pitch shifter.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "lecture.h"
|
#include "lecture.h"
|
||||||
|
|
||||||
|
/*
|
||||||
void lireTick (FMOD_SYSTEM* system, Motif* m, int tmp, FMOD_SOUND* sample[], FMOD_CHANNEL* chan[], int nbrPortees, int tempo) { // On va lire les ticks (plus petite division temporelle de la playlist) de haut en bas
|
void lireTick (FMOD_SYSTEM* system, Motif* m, int tmp, FMOD_SOUND* sample[], FMOD_CHANNEL* chan[], int nbrPortees, int tempo) { // On va lire les ticks (plus petite division temporelle de la playlist) de haut en bas
|
||||||
|
|
||||||
//int tempsPrecedent = SDL_GetTicks();
|
//int tempsPrecedent = SDL_GetTicks();
|
||||||
|
@ -33,16 +34,16 @@ void lireTick (FMOD_SYSTEM* system, Motif* m, int tmp, FMOD_SOUND* sample[], FMO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* while (SDL_GetTicks() - tempsPrecedent < 125) {} // Si 125 ms se sont écoulées (il faudra régler ce temps sur le tempo)
|
while (SDL_GetTicks() - tempsPrecedent < 125) {} // Si 125 ms se sont écoulées (il faudra régler ce temps sur le tempo)
|
||||||
tempsPrecedent = tempsPrecedent + 125;
|
tempsPrecedent = tempsPrecedent + 125;
|
||||||
Avouez que ce serait con qu'on ait besoin de SDL juste pour la temporisation
|
Avouez que ce serait con qu'on ait besoin de SDL juste pour la temporisation
|
||||||
alors qu'on peut utiliser la fonction native usleep pour ça, et beaucoup plus simplement. */
|
alors qu'on peut utiliser la fonction native usleep pour ça, et beaucoup plus simplement.
|
||||||
usleep(60000000/tempo);
|
usleep(60000000/tempo);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void lecture (int nombreChaines, int nombreInst, int tempo, Instrument* inst[], Motif* melodie[]) {
|
||||||
void lecture (int nombreChaines, int tempo, Motif* melodie[]) {
|
|
||||||
|
|
||||||
FMOD_SYSTEM *system;
|
FMOD_SYSTEM *system;
|
||||||
|
|
||||||
|
@ -57,8 +58,20 @@ void lecture (int nombreChaines, int tempo, Motif* melodie[]) {
|
||||||
|
|
||||||
FMOD_CHANNEL **chan = malloc(nombreChaines*sizeof(FMOD_CHANNEL*)); // On ouvre le nombre de chaines nécessaires dans le mixer
|
FMOD_CHANNEL **chan = malloc(nombreChaines*sizeof(FMOD_CHANNEL*)); // On ouvre le nombre de chaines nécessaires dans le mixer
|
||||||
|
|
||||||
FMOD_SOUND *sample[5]; // On charge les samples avec un message d'erreur en cas d'échec
|
FMOD_SOUND **sample = malloc(nombreInst*sizeof(FMOD_SOUND*));
|
||||||
|
|
||||||
|
// On charge les samples avec un message d'erreur en cas d'échec
|
||||||
|
|
||||||
|
for (int k = 0; k < nombreInst; k++) {
|
||||||
|
resultat = FMOD_System_CreateStream(system, getChemin(inst[k]), FMOD_SOFTWARE | FMOD_2D | FMOD_LOOP_NORMAL, 0, &sample[0]);
|
||||||
|
if (resultat != FMOD_OK)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Impossible de lire le fichier audio\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
resultat = FMOD_System_CreateStream(system, "lecture/0.wav", FMOD_SOFTWARE | FMOD_2D | FMOD_LOOP_NORMAL, 0, &sample[0]);
|
resultat = FMOD_System_CreateStream(system, "lecture/0.wav", FMOD_SOFTWARE | FMOD_2D | FMOD_LOOP_NORMAL, 0, &sample[0]);
|
||||||
if (resultat != FMOD_OK)
|
if (resultat != FMOD_OK)
|
||||||
{
|
{
|
||||||
|
@ -93,6 +106,7 @@ void lecture (int nombreChaines, int tempo, Motif* melodie[]) {
|
||||||
fprintf(stderr, "Impossible de lire le fichier audio\n");
|
fprintf(stderr, "Impossible de lire le fichier audio\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
//Lecture des motifs
|
//Lecture des motifs
|
||||||
|
@ -105,21 +119,21 @@ void lecture (int nombreChaines, int tempo, Motif* melodie[]) {
|
||||||
|
|
||||||
// DÉBUT DU COPIER COLLER POTENTIELLEMENT FOIREUX
|
// DÉBUT DU COPIER COLLER POTENTIELLEMENT FOIREUX
|
||||||
|
|
||||||
m = melodie[courant]
|
m = melodie[courant];
|
||||||
for (int chaine = 0; chaine < nombreChaines; chaine++) { // On va lire les chaines une à une par numéro croissant
|
for (int chaine = 0; chaine < nombreChaines; chaine++) { // On va lire les chaines une à une par numéro croissant
|
||||||
if (m != NULL) {
|
if (m != NULL) {
|
||||||
if (getInstrument(m,0,tmp) == -1) FMOD_Channel_Stop(chan[chaine]); // Si la note est un silence, la chaine s'arrête
|
if (getInstrument(m,0,i) == -1) FMOD_Channel_Stop(chan[chaine]); // Si la note est un silence, la chaine s'arrête
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (getNote(m,0,tmp) != 0) {
|
if (getNote(m,0,i) != -1) {
|
||||||
|
|
||||||
FMOD_Channel_Stop(chan[chaine]);
|
FMOD_Channel_Stop(chan[chaine]);
|
||||||
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sample[getInstrument(m,chaine,tmp)], 0, &chan[chaine]);
|
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sample[getInstrument(m,chaine,i)], 0, &chan[chaine]);
|
||||||
|
|
||||||
//Ici on va s'occuper du pitch
|
//Ici on va s'occuper du pitch
|
||||||
FMOD_DSP *pitch;
|
FMOD_DSP *pitch;
|
||||||
FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_PITCHSHIFT, &pitch);
|
FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_PITCHSHIFT, &pitch);
|
||||||
FMOD_DSP_SetParameter(pitch, FMOD_DSP_PITCHSHIFT_PITCH, 2.0);
|
FMOD_DSP_SetParameter(pitch, FMOD_DSP_PITCHSHIFT_PITCH, rapportPitch(inst[getInstrument(m,0,i)],getNote(m,0,i),4));
|
||||||
FMOD_Channel_AddDSP(chan[chaine], pitch, 0); // C'est quoi chan1 ??? Je l'ai remplacé par chan[1], vu que chan1 est as déclaré...
|
FMOD_Channel_AddDSP(chan[chaine], pitch, 0); // C'est quoi chan1 ??? Je l'ai remplacé par chan[1], vu que chan1 est as déclaré...
|
||||||
// On va passer une bonne journée...
|
// On va passer une bonne journée...
|
||||||
}
|
}
|
||||||
|
@ -140,7 +154,7 @@ void lecture (int nombreChaines, int tempo, Motif* melodie[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//On relache le système FMOD
|
//On relache le système FMOD
|
||||||
for (int i = 0; i <= nombreChaines; i++) {
|
for (int i = 0; i < nombreInst; i++) {
|
||||||
FMOD_Sound_Release(sample[i]);
|
FMOD_Sound_Release(sample[i]);
|
||||||
}
|
}
|
||||||
FMOD_System_Close(system);
|
FMOD_System_Close(system);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#define _LECTURE_H
|
#define _LECTURE_H
|
||||||
|
|
||||||
#include "../melodie/melodie.h"
|
#include "../melodie/melodie.h"
|
||||||
// #include "../instruments/instrument.h"
|
#include "../instruments/instruments.h"
|
||||||
// #include <SDL2/SDL.h>
|
// #include <SDL2/SDL.h>
|
||||||
// #include <SDL2/SDL_mixer.h>
|
// #include <SDL2/SDL_mixer.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -29,6 +29,6 @@
|
||||||
@param[in] tempo : vitesse de lecture
|
@param[in] tempo : vitesse de lecture
|
||||||
@param[in] melodie[] : tableau ordonné des motifs
|
@param[in] melodie[] : tableau ordonné des motifs
|
||||||
*/
|
*/
|
||||||
void lecture(int nbrChaines, int tempo, Motif* melodie[]);
|
void lecture(int nbrChaines, int nombreInst, int tempo, Instrument* inst[], Motif* melodie[]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
116
sources/main.c
116
sources/main.c
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include "motifs/motifs.h"
|
#include "motifs/motifs.h"
|
||||||
#include "melodie/melodie.h"
|
#include "melodie/melodie.h"
|
||||||
|
#include "samples/samples.h"
|
||||||
|
#include "instruments/instruments.h"
|
||||||
#include "lecture/lecture.h"
|
#include "lecture/lecture.h"
|
||||||
//#include <SDL2/SDL.h>
|
//#include <SDL2/SDL.h>
|
||||||
//#include <SDL2/SDL_mixer.h>
|
//#include <SDL2/SDL_mixer.h>
|
||||||
|
@ -31,6 +33,8 @@
|
||||||
|
|
||||||
#define DEF_NBR_TMP 16
|
#define DEF_NBR_TMP 16
|
||||||
#define MAX_PATTERNS 256
|
#define MAX_PATTERNS 256
|
||||||
|
#define NBR_INST 10
|
||||||
|
#define NBR_SMPL 5
|
||||||
|
|
||||||
// Fonctions de débug
|
// Fonctions de débug
|
||||||
|
|
||||||
|
@ -46,87 +50,112 @@ void afficherMotif(Motif* m, int nbrPortees){
|
||||||
|
|
||||||
// Fin des fonctions de débug
|
// Fin des fonctions de débug
|
||||||
|
|
||||||
void debut(Motif* melodie[], Motif* liste, int nbrPortees){
|
void debut(Motif* melodie[], Instrument* inst[], Sample* smpl[], Motif* liste, int nbrPortees){
|
||||||
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
||||||
Motif* m = liste;
|
Motif* m = liste;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
// My Little Pony.
|
// My Little Pony.
|
||||||
|
|
||||||
|
for (i = 0; i < DEF_NBR_TMP; i++) {
|
||||||
|
definirNote(m,0,i,-1);
|
||||||
|
}
|
||||||
|
|
||||||
definirNote(m,0,0,1);
|
definirNote(m,0,0,1);
|
||||||
definirInstrument(m,0,0,1);
|
definirInstrument(m,0,0,0);
|
||||||
definirInstrument(m,0,2,-1);
|
definirInstrument(m,0,2,-1);
|
||||||
definirNote(m,0,4,1);
|
definirNote(m,0,4,0);
|
||||||
definirInstrument(m,0,4,0);
|
definirInstrument(m,0,4,0);
|
||||||
definirNote(m,0,5,1);
|
definirNote(m,0,5,1);
|
||||||
definirInstrument(m,0,5,1);
|
definirInstrument(m,0,5,0);
|
||||||
definirInstrument(m,0,6,-1);
|
definirInstrument(m,0,6,-1);
|
||||||
definirNote(m,0,7,1);
|
definirNote(m,0,7,3);
|
||||||
definirInstrument(m,0,7,2);
|
definirInstrument(m,0,7,0);
|
||||||
definirInstrument(m,0,8,-1);
|
definirInstrument(m,0,8,-1);
|
||||||
definirNote(m,0,9,1);
|
definirNote(m,0,9,1);
|
||||||
definirInstrument(m,0,9,1);
|
definirInstrument(m,0,9,0);
|
||||||
definirInstrument(m,0,12,-1);
|
definirInstrument(m,0,12,-1);
|
||||||
|
|
||||||
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
||||||
Motif* n = liste;
|
Motif* n = liste;
|
||||||
|
|
||||||
// I used to wonder what friendship could be.
|
// I used to wonder what friendship could be.
|
||||||
definirNote(n,0,1,1);
|
|
||||||
definirInstrument(n,0,1,3);
|
for (i = 0; i < DEF_NBR_TMP; i++) {
|
||||||
definirNote(n,0,2,1);
|
definirNote(n,0,i,-1);
|
||||||
definirInstrument(n,0,2,3);
|
}
|
||||||
definirNote(n,0,3,1);
|
|
||||||
definirInstrument(n,0,3,3);
|
definirNote(n,0,1,5);
|
||||||
definirNote(n,0,4,1);
|
definirInstrument(n,0,1,0);
|
||||||
definirInstrument(n,0,4,3);
|
definirNote(n,0,2,5);
|
||||||
|
definirInstrument(n,0,2,0);
|
||||||
|
definirNote(n,0,3,5);
|
||||||
|
definirInstrument(n,0,3,0);
|
||||||
|
definirNote(n,0,4,5);
|
||||||
|
definirInstrument(n,0,4,0);
|
||||||
definirInstrument(n,0,5,-1);
|
definirInstrument(n,0,5,-1);
|
||||||
definirNote(n,0,6,1);
|
definirNote(n,0,6,1);
|
||||||
definirInstrument(n,0,6,1);
|
definirInstrument(n,0,6,0);
|
||||||
definirNote(n,0,7,1);
|
definirNote(n,0,7,3);
|
||||||
definirInstrument(n,0,7,2);
|
definirInstrument(n,0,7,0);
|
||||||
definirInstrument(n,0,8,-1);
|
definirInstrument(n,0,8,-1);
|
||||||
definirNote(n,0,9,1);
|
definirNote(n,0,9,1);
|
||||||
definirInstrument(n,0,9,1);
|
definirInstrument(n,0,9,0);
|
||||||
definirInstrument(n,0,10,-1);
|
definirInstrument(n,0,10,-1);
|
||||||
definirNote(n,0,11,1);
|
definirNote(n,0,11,5);
|
||||||
definirInstrument(n,0,11,3);
|
definirInstrument(n,0,11,0);
|
||||||
definirInstrument(n,0,12,-1);
|
definirInstrument(n,0,12,-1);
|
||||||
definirNote(n,0,13,1);
|
definirNote(n,0,13,3);
|
||||||
definirInstrument(n,0,13,2);
|
definirInstrument(n,0,13,0);
|
||||||
definirInstrument(n,0,14,-1);
|
definirInstrument(n,0,14,-1);
|
||||||
definirNote(n,0,15,1);
|
definirNote(n,0,15,1);
|
||||||
definirInstrument(n,0,15,1);
|
definirInstrument(n,0,15,0);
|
||||||
|
|
||||||
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
ajouterMotif(&liste, DEF_NBR_TMP, nbrPortees);
|
||||||
Motif* p = liste;
|
Motif* p = liste;
|
||||||
|
|
||||||
// Until you all shared its magic with me.
|
// Until you all shared its magic with me.
|
||||||
definirNote(p,0,0,1);
|
|
||||||
definirInstrument(p,0,0,3);
|
for (i = 0; i < DEF_NBR_TMP; i++) {
|
||||||
definirNote(p,0,1,1);
|
definirNote(p,0,i,-1);
|
||||||
definirInstrument(p,0,1,4);
|
}
|
||||||
|
|
||||||
|
definirNote(p,0,0,5);
|
||||||
|
definirInstrument(p,0,0,0);
|
||||||
|
definirNote(p,0,1,8);
|
||||||
|
definirInstrument(p,0,1,0);
|
||||||
definirInstrument(p,0,2,-1);
|
definirInstrument(p,0,2,-1);
|
||||||
definirNote(p,0,3,1);
|
definirNote(p,0,3,8);
|
||||||
definirInstrument(p,0,3,4);
|
definirInstrument(p,0,3,0);
|
||||||
definirInstrument(p,0,4,-1);
|
definirInstrument(p,0,4,-1);
|
||||||
definirNote(p,0,5,1);
|
definirNote(p,0,5,5);
|
||||||
definirInstrument(p,0,5,3);
|
definirInstrument(p,0,5,0);
|
||||||
definirInstrument(p,0,6,-1);
|
definirInstrument(p,0,6,-1);
|
||||||
definirNote(p,0,7,1);
|
definirNote(p,0,7,3);
|
||||||
definirInstrument(p,0,7,2);
|
definirInstrument(p,0,7,0);
|
||||||
definirInstrument(p,0,8,-1);
|
definirInstrument(p,0,8,-1);
|
||||||
definirNote(p,0,9,1);
|
definirNote(p,0,9,1);
|
||||||
definirInstrument(p,0,9,1);
|
definirInstrument(p,0,9,0);
|
||||||
definirNote(p,0,10,1);
|
definirNote(p,0,10,5);
|
||||||
definirInstrument(p,0,10,3);
|
definirInstrument(p,0,10,0);
|
||||||
definirInstrument(p,0,11,-1);
|
definirInstrument(p,0,11,-1);
|
||||||
definirNote(p,0,12,1);
|
definirNote(p,0,12,3);
|
||||||
definirInstrument(p,0,12,2);
|
definirInstrument(p,0,12,0);
|
||||||
definirInstrument(p,0,14,-1);
|
definirInstrument(p,0,14,-1);
|
||||||
|
|
||||||
ajouterMotifVirtuel(melodie,0,m);
|
ajouterMotifVirtuel(melodie,0,m);
|
||||||
ajouterMotifVirtuel(melodie,1,n);
|
ajouterMotifVirtuel(melodie,1,n);
|
||||||
ajouterMotifVirtuel(melodie,2,m);
|
ajouterMotifVirtuel(melodie,2,m);
|
||||||
ajouterMotifVirtuel(melodie,3,p);
|
ajouterMotifVirtuel(melodie,3,p);
|
||||||
|
|
||||||
|
// Définir les instruments les samples
|
||||||
|
|
||||||
|
ajouterSample(smpl,0,"lecture/0.wav");
|
||||||
|
setHauteur(smpl[0],440.0);
|
||||||
|
|
||||||
|
ajouterInstrument(inst,0);
|
||||||
|
setSample(inst[0],smpl[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char *argv[] ){
|
int main( int argc, char *argv[] ){
|
||||||
|
@ -206,11 +235,14 @@ void lancerLecture ()
|
||||||
{
|
{
|
||||||
Motif* melodie[MAX_PATTERNS] = {NULL};
|
Motif* melodie[MAX_PATTERNS] = {NULL};
|
||||||
Motif* liste = NULL;
|
Motif* liste = NULL;
|
||||||
|
Instrument* inst[NBR_INST] = {NULL};
|
||||||
|
Sample* smpl[NBR_SMPL] = {NULL};
|
||||||
|
|
||||||
int nbrPortees = 1;
|
int nbrPortees = 1;
|
||||||
courant = 0;
|
//courant = 0;
|
||||||
taille = 0;
|
taille = 0;
|
||||||
debut(melodie, liste, nbrPortees);
|
debut(melodie, inst, smpl, liste, nbrPortees);
|
||||||
lecture(nbrPortees,480,melodie);
|
lecture(nbrPortees,1,480,inst,melodie);
|
||||||
}
|
}
|
||||||
|
|
||||||
void quitter ()
|
void quitter ()
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
all : ponytracker clean
|
all : ponytracker clean
|
||||||
|
|
||||||
ponytracker : maintest.o lecture.o motifs.o melodie.o
|
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`
|
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
|
maintest.o : maintest.c
|
||||||
gcc -std=c99 -Wall -c maintest.c `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
|
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
|
motifs.o : ../motifs/motifs.c ../motifs/motifs.h
|
||||||
gcc -std=c99 -Wall -c motifs/motifs.c
|
gcc -std=c99 -Wall -c ../motifs/motifs.c
|
||||||
|
|
||||||
melodie.o : melodie/melodie.c melodie/melodie.h
|
melodie.o : ../melodie/melodie.c ../melodie/melodie.h
|
||||||
gcc -std=c99 -Wall -c melodie/melodie.c
|
gcc -std=c99 -Wall -c ../melodie/melodie.c
|
||||||
|
|
||||||
lecture.o : lecture/lecture.c lecture/lecture.h
|
lecture.o : ../lecture/lecture.c ../lecture/lecture.h
|
||||||
gcc -std=c99 -Wall -c lecture/lecture.c
|
gcc -std=c99 -Wall -c ../lecture/lecture.c
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
|
|
Binary file not shown.
|
@ -12,9 +12,9 @@ void afficherMotifActuel(){
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void definirCourant(int i){
|
/* void definirCourant(int i){
|
||||||
courant = i;
|
courant = i;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void ajouterMotifVirtuel(Motif* melodie[], int ind, Motif* m){
|
void ajouterMotifVirtuel(Motif* melodie[], int ind, Motif* m){
|
||||||
for (int i = taille; i > ind; i--) {
|
for (int i = taille; i > ind; i--) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ void afficherListeMotifs();
|
||||||
|
|
||||||
void afficherMotifActuel();
|
void afficherMotifActuel();
|
||||||
|
|
||||||
void definirCourant(int i);
|
//void definirCourant(int i);
|
||||||
|
|
||||||
void ajouterMotifVirtuel(Motif* melodie[], int ind, Motif* m);
|
void ajouterMotifVirtuel(Motif* melodie[], int ind, Motif* m);
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,10 @@
|
||||||
void ajouterSample(Sample* tab[], int i, char* chemin) {
|
void ajouterSample(Sample* tab[], int i, char* chemin) {
|
||||||
tab[i] = calloc(1,sizeof(Sample));
|
tab[i] = calloc(1,sizeof(Sample));
|
||||||
sprintf(tab[i]->nom,"Sample %d",i);
|
sprintf(tab[i]->nom,"Sample %d",i);
|
||||||
|
strcpy(tab[i]->chemin,chemin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void supprimerSample(Sample* tab[], int i, Poubelle** poub) {
|
void supprimerSample(Sample* tab[], int i) {
|
||||||
if (!(doitEtreSauvegarde(tab, i))) {
|
|
||||||
Poubelle* p = malloc(sizeof(Poubelle));
|
|
||||||
strcpy(p->chemin, tab[i]->chemin);
|
|
||||||
p->suiv = *poub;
|
|
||||||
*poub = p;
|
|
||||||
}
|
|
||||||
free(tab[i]);
|
free(tab[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef struct _sample{
|
||||||
|
|
||||||
void ajouterSample(Sample* tab[], int i, char* chemin);
|
void ajouterSample(Sample* tab[], int i, char* chemin);
|
||||||
|
|
||||||
void supprimerSample(Sample* tab[], int i, Poubelle** poub);
|
void supprimerSample(Sample* tab[], int i);
|
||||||
|
|
||||||
//void setResampling(Sample* sample, int deb, int fin);
|
//void setResampling(Sample* sample, int deb, int fin);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue