[Stk] Simple recurrent events in STK
Stephen Sinclair
sinclair at music.mcgill.ca
Thu, 22 Nov 2007 02:29:23 -0500
Hello,
Why not just use an integer counter in the callback function?
Hint: There are Stk::sampleRate() counts per second..
Steve
David Michael wrote:
>
> Thanks Gary
>
> I think this may actually be a decent solution. The way I had dealt
> with this previously is to use a simple unit generator that was
> "ticked" off at sample rate along with everything else in the program.
> When the generator hit its peak value, it triggered a sample to be
> played. This method is efficient enough on x86 machines, but I think
> it is a really expensive operation for ARM processors with out
> floating point coprocessors. Just looking for alternatives for
> recurrent timed events.
>
> Best
> David
>
> On Nov 21, 2007, at 4:14 PM, Gary Scavone wrote:
>
>> Hi David,
>>
>> There is a "sleep()" function in the Stk class, which calls either
>> "usleep" on unix systems or the Windoze "sleep" function. However,
>> it is not necessarily accurate. Unfortunately, timing functionality
>> is fairly system-dependent and I haven't gotten around to finding the
>> best solutions on the various supported platforms.
>>
>> Regards,
>>
>> --gary
>>
>> On 21-Nov-
>> 07, at 11:55 AM, David Michael wrote:
>>
>>> Hello
>>>
>>> I am curious if someone on list can point me in the right direction.
>>>
>>> I am trying to play samples on a specific interval, say every
>>> second. Ideally I would like to be able to adjust this interval. In
>>> Java, I would probably use something like Timer and TimerTask. Is
>>> there an equivalent in the STK to facilitate this, or should I look
>>> into a custom coding something in C++ using clock()?
>>>
>>> Thanks
>>> David
>>>
>>> _______________________________________________
>>> Stk mailing list
>>> Stk@ccrma.stanford.edu
>>> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>>
>> _______________________________________________
>> Stk mailing list
>> Stk@ccrma.stanford.edu
>> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>
> _______________________________________________
> Stk mailing list
> Stk@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk