1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <stdio.h>
#include<vector>
#include<math.h>
#include<conio.h>
#include "UpdateSignal.h"
using namespace std;
int UpdateBuffer(float echantillon, float *Buffer,int NumeroEchantillon,int tailleBuffer)
/*ech = l'echantillon courant (la donnée courante)
* Buffer = le tableau qui contient les échantillons
* indice = nunero de l'echantillon;
* tailleBuffer = taille du tableau buffer
*
* */
{ vector<float> sigEntre; //tableau destiné à contenir tous les echentillons
int p=1;
while(p==1) // Tant qu'il ya un echantillon je l'ajoute au tableau sigEntre
{ p=0;
sigEntre.push_back(echantillon);
float *tmp=new float[tailleBuffer];// variable temporaire
for (int k=0;k<tailleBuffer;++k)
{ //je souhaite mettre le dernier echantillon dans la première case du Buffer
tmp[k]=sigEntre[sigEntre.size()];
Buffer[k]=tmp[k]; // recuperation des echantillons dans le buffer
}
delete tmp;
NumeroEchantillon = sigEntre.size();// recuperation du numero de l'echantillon
p++;
}
return NumeroEchantillon;
} |
Partager