Last change
on this file since 2238 was 2187, checked in by aubourg, 23 years ago |
Vivien, limites processors et connect
|
File size:
1.1 KB
|
Rev | Line | |
---|
[2187] | 1 | // ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
|
---|
| 2 | // Eric Aubourg
|
---|
| 3 | // Christophe Magneville
|
---|
| 4 | // Reza Ansari
|
---|
| 5 | // $Id: toidelay.cc,v 1.1 2002-09-09 15:33:15 aubourg Exp $
|
---|
| 6 |
|
---|
| 7 | #include "toimanager.h"
|
---|
| 8 | #include "toidelay.h"
|
---|
| 9 |
|
---|
| 10 | TOIDelay::TOIDelay(int n) {
|
---|
| 11 | delay = n;
|
---|
| 12 | nskip = ndrop = 0;
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | void TOIDelay::init() {
|
---|
| 16 | declareInput("signal");
|
---|
| 17 | declareOutput("signal");
|
---|
| 18 | upExtra = delay + ndrop;
|
---|
| 19 | lowExtra = nskip;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | #define BUFSZ 4096
|
---|
| 23 |
|
---|
| 24 | void TOIDelay::run() {
|
---|
| 25 | int snb = getMinIn()+nskip;
|
---|
| 26 | int sne = getMaxIn()-ndrop;
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | if(snb>sne) {
|
---|
| 30 | cout<<"TOIDelay::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
|
---|
| 31 | throw ParmError("TOIDelay::run() - Bad sample interval");
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | cout << "TOIDelay delay="<<delay<< " sn : " << snb << " - " << sne << endl;
|
---|
| 35 |
|
---|
| 36 | double* buf = new double[BUFSZ];
|
---|
| 37 |
|
---|
| 38 | int sn = snb;
|
---|
| 39 | while (sn <= sne) {
|
---|
| 40 | int sn2 = sn + BUFSZ - 1;
|
---|
| 41 | if (sn2>sne) sn2=sne;
|
---|
| 42 | int nsamp = sn2-sn+1;
|
---|
| 43 | getData(0, sn+delay, nsamp, buf);
|
---|
| 44 | putData(0, sn, nsamp, buf);
|
---|
| 45 | sn += nsamp;
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.