[Stk] fast time domain filter implementation

Stephen Sinclair sinclair at music.mcgill.ca
Tue Apr 15 09:40:19 PDT 2008


Hi Gary!

Gary Scavone wrote:
> Hi Stephen,
>
> The vector [] operator does not do bounds checking and it _should_ be 
> defined inline by the class.

It's good to know that it doesn't do bounds checking, I wasn't sure.  I 
would think the STL programmers were good enough to ensure that if 
optimized correctly the Vector class would compile to the equivalent of 
a normal array.  But I wouldn't put it past the VS programmers to not 
properly handle inline in Debug mode.  I can say that in my experience, 
the presence of a /O flag was the difference between my algorithm 
running properly and not running at all.  But this was only true when I 
compiled it with Visual Studio, it ran fine on Linux.
The STK piano does use quite a few filters, and it uses the subclasses 
rather than Filter directly, as you mention.


> I think the Windows stutter problem is more related to DirectSound ... 
> it's a terrible API.  Always use ASIO drivers on Windoze if possible.

Yeah, I definitely agree here.  I've especially noticed that for example 
with Pd I have to set the buffer size to like 100 ms to avoid stuttering 
without ASIO.


>
> Note that there are currently inefficiencies with virtualized 
> functions in many of the classes, though that shouldn't be the case 
> when using the Filter class.  It would be an issue with subclasses of 
> Filter.  This is something I plan to address this Spring/Summer.

Hm, that's interesting, I hadn't thought of that in relation to the 
Filter subclasses.  Do virtual functions really insert a non-negligible 
amount of delay?  I guess if you put several thousand of them together 
under real-time constraints then every look-up operation counts.


Steve



More information about the Stk mailing list