ponytracker/sources/instruments/instruments.c

49 lines
911 B
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]);
}
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);
}