Update of /cvsroot/foo/foo/libfoo/modules
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25010/modules
Modified Files:
FOOMReadBpf.h FOOMReadBpf.m
Log Message:
fixed bpf when starting calculation inside bpf (e.g. with ref/off)
Index: FOOMReadBpf.m
===================================================================
RCS file: /cvsroot/foo/foo/libfoo/modules/FOOMReadBpf.m,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FOOMReadBpf.m 14 Dec 2007 14:16:14 -0000 1.1
--- FOOMReadBpf.m 22 Mar 2009 01:11:40 -0000 1.2
***************
*** 40,45 ****
- #define FIRST_TIME -1
-
@implementation FOOMReadBpf
--- 40,43 ----
***************
*** 55,64 ****
_substrate = substr;
_beginT = TIMEFRAME;
! _lasttime = FIRST_TIME;
_current = [_substrate segments];
! for (sp = _current; sp->count != 0; sp++)
! {
! ;
! }
_last = sp;
--- 53,59 ----
_substrate = substr;
_beginT = TIMEFRAME;
! _firsttime = YES;
_current = [_substrate segments];
! for (sp = _current; sp->count != 0; sp++);
_last = sp;
***************
*** 73,80 ****
[super reset];
_current = [_substrate segments];
! for (sp = _current; sp->count != 0; sp++)
! {
! ;
! }
_last = sp;
--- 68,73 ----
[super reset];
_current = [_substrate segments];
! _firsttime = YES;
! for (sp = _current; sp->count != 0; sp++);
_last = sp;
***************
*** 116,129 ****
COMPUTE_PROLOGUE;
p = DATA_OF_BUF(_buffer);
! if (_lasttime == FIRST_TIME)
{
! for (count = 0; count < _begin - SAMPLETIME; count++)
! {
! *p++ = 0;
}
- _offset = 0;
- _lasttime = SAMPLETIME;
}
! while (count < BLOCKSIZE)
{
if (_current == _last)
--- 109,148 ----
COMPUTE_PROLOGUE;
p = DATA_OF_BUF(_buffer);
! if (_firsttime == YES)
{
! _firsttime = NO;
!
! if (SAMPLETIME <= _begin)
! { /* start before or at our begin */
! for (count = 0; count < _begin - SAMPLETIME; count++)
! {
! *p++ = 0;
! }
! _offset = 0;
! }
! else
! { /* find current segment */
! lineseg_t *sp;
! int acc_count = _begin;
!
! for (sp = _current; acc_count + sp->count <= SAMPLETIME; acc_count += sp->count, ++sp);
! _current = sp;
! _offset = SAMPLETIME - acc_count;
!
! /* calculate current phase */
! if (_current->alpha == 0)
! {
! _phase = _offset * _current->delta;
! }
! else
! {
! _factor = pow(exp(_current->alpha), 1. / (_current->count - 1));
! _phase = 1. / _factor;
! _phase = _phase * pow(_factor, _offset);
! }
}
}
!
! while (count < BLOCKSIZE)
{
if (_current == _last)
***************
*** 134,138 ****
}
}
! else
{
debut = _offset;
--- 153,157 ----
}
}
! else
{
debut = _offset;
***************
*** 143,147 ****
restSeg = curr_count - _offset;
restBlk = BLOCKSIZE - count;
! if (_offset == 0)
{
if (alpha == 0)
--- 162,166 ----
restSeg = curr_count - _offset;
restBlk = BLOCKSIZE - count;
! if (_offset == 0)
{
if (alpha == 0)
***************
*** 161,166 ****
_offset += restBlk;
}
! else
! {
fin = _offset + restSeg;
count += restSeg;
--- 180,185 ----
_offset += restBlk;
}
! else
! {
fin = _offset + restSeg;
count += restSeg;
***************
*** 168,172 ****
_current++;
}
! if (alpha == 0)
{
double ph = _phase;
--- 187,191 ----
_current++;
}
! if (alpha == 0)
{
double ph = _phase;
***************
*** 178,183 ****
}
_phase = ph;
! }
! else
{
double ph = _phase;
--- 197,202 ----
}
_phase = ph;
! }
! else
{
double ph = _phase;
***************
*** 192,196 ****
}
}
- _lasttime = SAMPLETIME + BLOCKSIZE;
COMPUTE_EPILOGUE;
}
--- 211,214 ----
Index: FOOMReadBpf.h
===================================================================
RCS file: /cvsroot/foo/foo/libfoo/modules/FOOMReadBpf.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FOOMReadBpf.h 14 Dec 2007 14:16:14 -0000 1.1
--- FOOMReadBpf.h 22 Mar 2009 01:11:40 -0000 1.2
***************
*** 51,55 ****
lineseg_t *_last;
int _offset;
! int _lasttime;
double _beginT;
double _phase;
--- 51,55 ----
lineseg_t *_last;
int _offset;
! BOOL _firsttime;
double _beginT;
double _phase;
|