View Full Version : GetSamplePos()
olilarkin
04-16-2009, 03:18 PM
I'm trying to make a simple sample-accurate, beat synchronised ramp for a plugin i'm making. I commented out all the stuff in ProcessDoubleReplacing() in the iplug example, and used GetSamplePos(), to get the current sample position, however calling this alone in the sample loop seems to use up 20% of my cpu when i tested the VST version in MaxMSP (on Mac) ! It was about 8% in Live.
Am i doing something totally idiotic? Is there a simpler way to do this.
thanks,
oli
schwa
04-16-2009, 03:48 PM
GetSamplePos is a host callback (because only the host knows where in the project it is), it's up to the host how expensive the call is.
But, there's no point in calling it inside the loop -- it gives the sample position of the sample buffer passed to the plugin. You can call it once at the top of the function to get the starting position and then just increment in your loop.
olilarkin
04-16-2009, 05:30 PM
thanks shwa, i realised i didn't have to call it every sample just after i posted...doh. One thing though... if i want a beat synchronised ramp, if the transport position gets changed mid block, i guess my ramp will be off. Or maybe the transport never position never jumps mid block?...thinking out loud.
oli
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.