62 lines
1.1 KiB
C
62 lines
1.1 KiB
C
/**
|
|
* @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]);
|
|
}
|
|
|
|
char* getChemin(Instrument* inst) {
|
|
return inst->sample->chemin;
|
|
}
|
|
|
|
int getVolumeInst(Instrument* inst) {
|
|
return inst->volume;
|
|
}
|
|
|
|
int getBalance(Instrument* inst) {
|
|
return inst->balance;
|
|
}
|
|
|
|
char* getNomInst(Instrument* inst) {
|
|
return inst->nom;
|
|
}
|
|
|
|
Sample* getSample(Instrument* inst) {
|
|
return inst->sample;
|
|
}
|
|
|
|
void setVolumeInst(Instrument* inst, int volume) {
|
|
inst->volume = volume;
|
|
}
|
|
|
|
void setBalanceInst(Instrument* inst, int balance) {
|
|
inst->balance = balance;
|
|
}
|
|
|
|
void setNomInst(Instrument* inst, char* nom) {
|
|
strcpy(inst->nom,nom);
|
|
}
|
|
|
|
void setSample(Instrument* inst, Sample* smpl){
|
|
inst->sample = smpl;
|
|
}
|
|
|
|
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);
|
|
}
|