Module instrument qui compile, mais qui reste à tester.
This commit is contained in:
parent
047ac6b73f
commit
2928c5869d
|
@ -35,4 +35,7 @@ sources/GUI/coucou
|
||||||
sources/tests/test
|
sources/tests/test
|
||||||
sources/instrument/main
|
sources/instrument/main
|
||||||
sources/fichier/.fichier.h.swp
|
sources/fichier/.fichier.h.swp
|
||||||
sources/samples/.samples.h.swp
|
sources/samples/.samples.h.swp
|
||||||
|
sources/instruments/.instruments.h.swp
|
||||||
|
sources/instruments/.instruments.c.swp
|
||||||
|
sources/instruments/instruments.o
|
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
* @file instruments.c
|
||||||
|
*
|
||||||
|
* Implémentation de sample.h
|
||||||
|
*
|
||||||
|
* @version 1
|
||||||
|
* @author Guy
|
||||||
|
* @date Mai 2014
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "instruments.h"
|
||||||
|
|
||||||
|
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
|
#ifndef _instruments_h
|
||||||
#define _instruments_h
|
#define _instruments_h
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
#include "../samples/samples.h"
|
#include "../samples/samples.h"
|
||||||
|
|
||||||
typedef struct _enveloppe {
|
typedef struct _enveloppe {
|
||||||
|
@ -16,10 +29,24 @@ typedef struct _intrument {
|
||||||
Enveloppe enveloppe;
|
Enveloppe enveloppe;
|
||||||
int balance;
|
int balance;
|
||||||
int volume;
|
int volume;
|
||||||
char[] nom;
|
char* nom;
|
||||||
} Instrument;
|
} Instrument;
|
||||||
|
|
||||||
// TODO
|
int getVolume(Instrument* inst);
|
||||||
// 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é.
|
|
||||||
|
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
|
#endif
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue