[Stk] Memory Allocation in STK

Richard Dobson richarddobson at blueyonder.co.uk
Tue, 12 Feb 2008 10:52:42 +0000


  It's fine (talking about Filter here) so long as you don't change the 
size of the filter (i.e. change the ~number~ of coefficients). That's 
the only circumstance in which the allocator will be invoked (see 
Filter.cpp); and not something you would want to do in the processing 
loop anyway.


Richard Dobson


Jeremy Jurksztowicz wrote:
> Hello,
> 
> I searched the archives with Google briefly, but my search terms came
> up with no relevant info.
> 
> I noticed that in the Filter class, as well as Skini::Message, you are
> using std::vector, which uses system memory allocation routines. In a
> realtime threading context, system allocators are very dangerous,
> because they could take more time to complete than the amount of time
> the sound driver has to fill it's buffers. In the case of the Filter
> class, if I want to safely change the coefficients during sound
> processing, I have to take the filter class 'offline' (remove it from
> the realtime sound stream somehow) adjust it's values and put it back.
> 
> Now, I know I understand basic realtime audio programming, but I am
> not sure I understand STK (having just downloaded it recently), so I
> may be missing something obvious (like a FAQ). Please forgive a
> newbie, and point me to some info if you may.
> 
> Thanks,
> Jeremy Jurksztowicz
>