(resent, previously sent from non member account)
First: Is the code correct?
pos=lrintf(counter);
Shouldn't pos be lower than counter and pos+1 higher? Like this
pos <= counter < pos+1
pos = (int)(counter);
=> I use this in my tests.
Second: Why the 'volatile'?
You should never be that timing sensitive that it makes a difference...
(let the producer enter an interrupt and...)
Third: Compilators hates pointers and loves arrays - strange ehh..
Modified the code to this, note the added loop counter.
int ix;
for (ix = 0; ix < todo; ix++) {
pos=(int)(counter);
counter+=advance_f;
res = src_ptr[pos];
res_next = src_ptr[pos+1];
res += (res_next-res) * (counter-(float)pos);
res *= volume_f;
dst_ptr[ix] +=res;
}
Results:
PIII 933 MHz volatile non volatile
pointer dst 5.0 s 4.9 s
array dst 4.5 s 4.1 s
/RogerL
--
Roger Larsson
SkellefteƄ
Sweden