Merge branch 'master' of ssh://abwabwa.org:55555/home/git/ponytracker
This commit is contained in:
48
sources/instruments/instruments.c
Normal file
48
sources/instruments/instruments.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @file instruments.c
|
||||
*
|
||||
* Implémentation de sample.h
|
||||
*
|
||||
* @version 1
|
||||
* @author Guy
|
||||
* @date Mai 2014
|
||||
*/
|
||||
|
||||
#include "instruments.h"
|
||||
|
||||
void ajouterInstrument(Instrument* tab[], int i){
|
||||
tab[i]=calloc(1,sizeof(Instrument));
|
||||
strcpy(tab[i]->nom,"Nouvel instrument");
|
||||
}
|
||||
|
||||
void supprimerInstrument(Instrument* tab[], int i){
|
||||
free(tab[i]);
|
||||
}
|
||||
|
||||
int getVolume(Instrument* inst) {
|
||||
return inst->volume;
|
||||
}
|
||||
|
||||
int getBalance(Instrument* inst) {
|
||||
return inst->balance;
|
||||
}
|
||||
|
||||
char* getNomInst(Instrument* inst) {
|
||||
return inst->nom;
|
||||
}
|
||||
void setVolume(Instrument* inst, int volume) {
|
||||
inst->volume = volume;
|
||||
}
|
||||
|
||||
void setBalance(Instrument* inst, int balance) {
|
||||
inst->balance = balance;
|
||||
}
|
||||
|
||||
void setNomInst(Instrument* inst, char* nom) {
|
||||
strcpy(inst->nom,nom);
|
||||
}
|
||||
|
||||
float rapportPitch(Instrument* inst, int note, int octave){
|
||||
float freq = 440*pow(2,(octave-3)+(note-11)*(1.0/12.0));
|
||||
return freq/(inst->sample->hauteur_ref);
|
||||
}
|
||||
@@ -1,8 +1,21 @@
|
||||
/**
|
||||
* @file instruments.h
|
||||
*
|
||||
* Gestion des instruments
|
||||
*
|
||||
* @version 1
|
||||
* @author Guy
|
||||
* @date Mai 2014
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _instruments_h
|
||||
#define _instruments_h
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "../samples/samples.h"
|
||||
|
||||
typedef struct _enveloppe {
|
||||
@@ -16,10 +29,28 @@ typedef struct _intrument {
|
||||
Enveloppe enveloppe;
|
||||
int balance;
|
||||
int volume;
|
||||
char[] nom;
|
||||
char nom[20];
|
||||
} Instrument;
|
||||
|
||||
// TODO
|
||||
// Setters-getters et tous le bordel, rien de bien compliqué, mais j'avoue qu'à cette heure ci, j'ai un peu la flemme et je suis trop crevé.
|
||||
void ajouterInstrument(Instrument* tab[], int i);
|
||||
|
||||
void supprimerInstrument(Instrument* tab[], int i);
|
||||
|
||||
int getVolume(Instrument* inst);
|
||||
|
||||
int getBalance(Instrument* inst);
|
||||
|
||||
char* getNomInst(Instrument* inst);
|
||||
|
||||
void setVolume(Instrument* inst, int volume);
|
||||
|
||||
void setBalance(Instrument* inst, int balance);
|
||||
|
||||
void setNomInst(Instrument* inst, char* nom);
|
||||
|
||||
/*
|
||||
* Cette fonction prend une note et une octave en paramètre et renvoie la valeur à entrer dans le pitch shifter.
|
||||
*/
|
||||
float rapportPitch(Instrument* inst, int note, int octave);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Ce module impl<70>mente les fonctions du fichier lecture.h
|
||||
*
|
||||
* @version 1
|
||||
* @author Module CSC3502 : Projet Informatique 1<>re ann<6E>e TELECOM SudParis
|
||||
* @date Mai 2014
|
||||
*/
|
||||
* @author Quentin, Guy
|
||||
* @date Mai 2014
|
||||
*/
|
||||
|
||||
#include "lecture.h"
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Lecture de la mélodie
|
||||
*
|
||||
* @version 1
|
||||
* @author Module CSC3502 : Projet Informatique 1ère année TELECOM SudParis
|
||||
* @date Mai 2014
|
||||
*/
|
||||
* @author Quentin, Guy
|
||||
* @date Mai 2014
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _LECTURE_H
|
||||
@@ -26,8 +26,8 @@
|
||||
/**
|
||||
Permet la lecture d'un motif
|
||||
@param[in] nbrChaines : nombre de chaines
|
||||
@param[in] tempo : nombre de tempo
|
||||
@param[in] melodie[] : motif lu
|
||||
@param[in] tempo : vitesse de lecture
|
||||
@param[in] melodie[] : tableau ordonné des motifs
|
||||
*/
|
||||
void lecture(int nbrChaines, int tempo, Motif* melodie[]);
|
||||
|
||||
|
||||
50
sources/samples/samples.c
Normal file
50
sources/samples/samples.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @file samples.c
|
||||
*
|
||||
* Implémentation de samples.h
|
||||
*
|
||||
* @version 1
|
||||
* @author Guy
|
||||
* @date Mai 2014
|
||||
*/
|
||||
|
||||
#include "samples.h"
|
||||
|
||||
int doitEtreSauvegarde(Sample* tab[], int i) {
|
||||
return !(tab[i]->chemin[0]=='.' && tab[i]->chemin[1]=='/');
|
||||
}
|
||||
|
||||
void setSauvegarde(Sample* tab[], int i) {
|
||||
sprintf(tab[i]->chemin,"./%d.wav",i);
|
||||
}
|
||||
|
||||
void ajouterSample(Sample* tab[], int i, char* chemin) {
|
||||
tab[i] = calloc(1,sizeof(Sample));
|
||||
sprintf(tab[i]->nom,"Sample %d",i);
|
||||
}
|
||||
|
||||
void supprimerSample(Sample* tab[], int i, Poubelle** poub) {
|
||||
if (!(doitEtreSauvegarde(tab, i))) {
|
||||
Poubelle* p = malloc(sizeof(Poubelle));
|
||||
strcpy(p->chemin, tab[i]->chemin);
|
||||
p->suiv = *poub;
|
||||
*poub = p;
|
||||
}
|
||||
free(tab[i]);
|
||||
}
|
||||
|
||||
void setNom(Sample* sample, char nom[]) {
|
||||
strcpy(sample->nom,nom);
|
||||
}
|
||||
|
||||
void setHauteur(Sample* sample, float hauteur) {
|
||||
sample->hauteur_ref = hauteur;
|
||||
}
|
||||
|
||||
char* getNom(Sample* sample) {
|
||||
return sample->nom;
|
||||
}
|
||||
|
||||
float getHauteur(Sample* sample) {
|
||||
return sample->hauteur_ref;
|
||||
}
|
||||
@@ -1,38 +1,67 @@
|
||||
/**
|
||||
* @file samples.h
|
||||
*
|
||||
* Gestion des samples
|
||||
*
|
||||
* @version 1
|
||||
* @author Guy
|
||||
* @date Mai 2014
|
||||
*/
|
||||
|
||||
#ifndef _samples_h
|
||||
#define _samples_h
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../fmod/include/fmod.h"
|
||||
|
||||
typedef struct _sample{
|
||||
//TODO
|
||||
// Je propose un truc, mais c'est à Quentin de le compléter,
|
||||
// voire de le changer complètement.
|
||||
char[] son; // contient le nom du fichier WAV (qui sera placé dans le sous-dossier samples)
|
||||
char[] nom; // juste un nom pour qu'on puisse humainement identifier le sample
|
||||
char chemin[500]; // contient le nom du fichier WAV (qui sera placé dans le sous-dossier samples)
|
||||
char nom[10]; // juste un nom pour qu'on puisse humainement identifier le sample
|
||||
// Infos relatives au resampling
|
||||
unsigned long int deb; // numéro de l'échantillon de début
|
||||
unsigned long int fin; // numéro de l'échantillon de fin
|
||||
float hauteur_ref; // fréquence de la hauteur du sample à l'état brut (sans repitching)
|
||||
char fichier; // vaut 1 si le sample doit être ajouté au projet lors de la prochaine sauvegarde, 0 sinon.
|
||||
} Sample;
|
||||
|
||||
typedef Sample* Tab_samples[];
|
||||
/**
|
||||
* Il s'agit de définir une liste des samples à supprimer lors de la prochaine sauvegarde.
|
||||
*/
|
||||
typedef struct _poubelle{
|
||||
char chemin[500];
|
||||
struct _poubelle* suiv;
|
||||
} Poubelle;
|
||||
|
||||
void ajouterSample(Tab_samples tab[], int i, char chemin[]);
|
||||
/**
|
||||
* Cette fonction à valeur booléenne détermine si le fichier doit être copié dans le dossier de sauvegarde.
|
||||
*/
|
||||
int doitEtreSauvegarde(Sample* tab[], int i);
|
||||
|
||||
void setResampling(Sample* sample, int deb, int fin);
|
||||
/**
|
||||
* Cette procédure définit le statut du fichier comme déjà copié dans la sauvegarde.
|
||||
*/
|
||||
void setSauvegarde(Sample* tab[], int i);
|
||||
|
||||
void setNom(Sample* sample, char[] nom);
|
||||
void ajouterSample(Sample* tab[], int i, char* chemin);
|
||||
|
||||
void supprimerSample(Sample* tab[], int i, Poubelle** poub);
|
||||
|
||||
//void setResampling(Sample* sample, int deb, int fin);
|
||||
|
||||
void setNom(Sample* sample, char nom[]);
|
||||
|
||||
void setHauteur(Sample* sample, float hauteur);
|
||||
|
||||
unsigned long int getDeb(Sample* sample);
|
||||
//unsigned long int getDeb(Sample* sample);
|
||||
|
||||
unsigned long int getFin(Sample* sample);
|
||||
//unsigned long int getFin(Sample* sample);
|
||||
|
||||
char[] getNom(Sample* sample);
|
||||
char* getNom(Sample* sample);
|
||||
|
||||
float getHeuteur(Sample* sample);
|
||||
float getHauteur(Sample* sample);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user