43 lines
776 B
C
43 lines
776 B
C
|
/**
|
||
|
* @file samples.c
|
||
|
*
|
||
|
* Implémentation de samples.h
|
||
|
*
|
||
|
* @version 1
|
||
|
* @author Guy
|
||
|
* @date Mai 2014
|
||
|
*/
|
||
|
|
||
|
#include "samples.h"
|
||
|
|
||
|
void ajouterSample(Sample* tab[], int i, char* chemin) {
|
||
|
tab[i] = calloc(1,sizeof(Sample));
|
||
|
sprintf(tab[i]->nom,"Sample %d",i);
|
||
|
}
|
||
|
|
||
|
void supprimerSample(Sample* tab[], int i, Poubelle** poub) {
|
||
|
if (!(doitEtreSauvegarde(tab, i))) {
|
||
|
Poubelle* p = malloc(sizeof(Poubelle));
|
||
|
strcpy(p->chemin, tab[i]->chemin);
|
||
|
p->suiv = *poub;
|
||
|
*poub = p;
|
||
|
}
|
||
|
free(tab[i]);
|
||
|
}
|
||
|
|
||
|
void setNom(Sample* sample, char nom[]) {
|
||
|
strcpy(sample->nom,nom);
|
||
|
}
|
||
|
|
||
|
void setHauteur(Sample* sample, float hauteur) {
|
||
|
sample->hauteur_ref = hauteur;
|
||
|
}
|
||
|
|
||
|
char* getNom(Sample* sample) {
|
||
|
return sample->nom;
|
||
|
}
|
||
|
|
||
|
float getHauteur(Sample* sample) {
|
||
|
return sample->hauteur_ref;
|
||
|
}
|