ponytracker/sources/instruments/instruments.c

40 lines
708 B
C
Raw Normal View History

/**
* @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);
}