> And what vline does, is it reads that list, and then schedules itself to be
> hit after the correct amount of logical time has elapsed.
I'm not exactly sure what "schedules itself" means here. So I'll juststart
explaining how it works until I understand it myself... :)
The [vline~]object processes blocks of samples at a time (in
vline_tilde_perform). Butany of those clock events Frank mentioned that happen
to be "ripe" forthe upcoming block get sent to the "float" method of line
(vline_tilde_float),which adds them to the linked list x_xlist.
For example,suppose you have the following:
[0 0.1, 1 0.2(|[pipe]|[vline~]
|[print~]
When you click the message box, [pipe] does the proper clock delay foreach
message: the "0" is scheduled for 0.1ms in the future, and the "1" isscheduled
for 0.2ms. But these delay times take less time to fire than ittakes to
compute a block. So if [vline~] is calculating its output in blocks
of 64 samples, when does it actually receive the output from [pipe~]?
The answer is that Pd actually sends the "0" and "1" messages to [vline~]one
after the other, before it calculates the next block. By "send" I mean itcalls
the function vline_tilde_float with the float argument "0", and then it
callsvline_tilde_float with the float argument "1". But before each of those
calls, it updates the "sys_time" to be the time when that clock was set to go
off. So if the "0" was set to go off at "now + 0.1", Pd sets "now+0.1" to be
the new system time, then it sends the "0" message to vline_tilde_float. And
before it sends "1",
it sets the sys_time to "now + 0.2".
Let's go back to vline_tilde_float-- notice in the first line we're fetching
thesys_time. And what is it going to be for our "0" message? As stated above,
weset it to "now + 0.1". Great! And when we process "1" message, we get "now
+ 0.2". Thus, [vline~] adds those messages and their associated timings to the
linked list.
Finally, we do [vline~] perform routine. It starts with the time equal to what
itwas at the beginning of the block. Then it loops through our block's
samplesuntil it reaches a sample that corresponds to the time that an event in
ourlinked list needs to be triggered. When we reach that sample, we jump tothe
new value.
It's the same process for ramps, except that vline~ calculates an
incrementvalue for the ramp.
After looking, I'm kind of curious what is most responsible for
[vline~]overhead. I'd guess it's the math needed to set each ramp segment, but
I'm notcertain.
-Jonathan
On Saturday, September 26, 2015 10:55 PM, i go bananas
<[email protected]> wrote:
I actually think Frank might have the my answer here.
What i'm noticing, is not an inconsistency in the length of the ramps. It's an
inconsisency in when they are first triggered. This is for stuff like the
initial click of a bassdrum, so you can even hear the difference quite clearly.
The line object jumps around, as it is being triggered on block boundaries,
but the vline object is faithfully consistent in starting at the exact TIME i
ask it to - regardless of blocksize, etc.
The only logical answer i can see here, is the one Frank has given. I'm
scheduling drums using a clock controlled by metro.
So what i'm guessing that Frank is suggesting here, is that the scheduler is
keeping a list of all the metro and delay bangs that should arrive in the
upcoming block, and sceduling them to be hit while the block plays. And what
vline does, is it reads that list, and then schedules itself to be hit after
the correct amount of logical time has elapsed.
And i would guess that the normal line object is not capable of that. It just
waits until block boundaries and starts its simple incrementation.
So, going back to Jonathan's day-long block example, i can see now how that
works. the line can only be triggered once, at the start of the block (i still
have doubts that it would actually stretch to the length of the block though.
I reckon a 50ms line is still gonna take 50ms. ) But the vline has that linked
list inbuilt, and it reads from the scheduler to see when it should be
triggered. So if you had the day-long block, then vline's linked list is gonna
end up with a full day's worth of messages in it!
Anyway, i'll go back to the source code tomorrow and have another look. But
pretty sure that i now see how it is the ability to look ahead at metro
scheduled events that gives vline the accuracy i need.
Thanks Matt for suggesting i look at the clock, and scheduler code, thanks
Jonothan for the great example of the day long block - taking things to
extremes like that is a good way to see how they work. And thanks Frank for
finally turning on that lightbulb and suggesting the role that metro was
playing here.
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list