Module instrument qui compile, mais qui reste à tester.
This commit is contained in:
parent
047ac6b73f
commit
2928c5869d
|
@ -36,3 +36,6 @@ sources/tests/test
|
|||
sources/instrument/main
|
||||
sources/fichier/.fichier.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
|
||||
#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,24 @@ typedef struct _intrument {
|
|||
Enveloppe enveloppe;
|
||||
int balance;
|
||||
int volume;
|
||||
char[] nom;
|
||||
char* nom;
|
||||
} 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é.
|
||||
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
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue