[Stk] Simple recurrent events in STK
David Michael
david at unnature.net
Thu, 22 Nov 2007 10:35:49 -0500
Hi Steve
Yep, I am doing something really similar within my unit generator.
void RecurrentSamplePlayer::computeSample( )
{
if( elapsed_time >= _period ) {
triggerSample();
elasped_time = 0;
}
else{
elapsed_time++;
}
}
Is there a more efficient way of doing this without the conditional
evaluation at sample rate?
I thought maybe have the program/thread sleep() for the amount of
time I wanted. That way there would not be any real processing going
on between sample triggers. You bring up a point though, since this
is only integer increments, this is probably not the place in the
program that is killing the sans-FPU processor.
D
On Nov 22, 2007, at 2:29 AM, Stephen Sinclair wrote:
> Hello,
>
> Why not just use an integer counter in the callback function?
> Hint: There are Stk::sampleRate() counts per second..
>
> Steve