Old 26th October 2018, 03:55   #1
Junior Member
Join Date: Oct 2018
Posts: 2
Getting time elapsed since preset was loaded?

Hi everyone I am new to preset development so this may be a basic or obvious question but I would really like some help here as I haven't found the answer I'm looking for in the preset authoring guide.

I know you can use the time and frame values to get the time and number of frames elapsed since the program started. But how would you go about getting the time or frames elapsed since the preset was opened? Is there a work around for this? I don't necessarily need the exact time, just a value that starts at 0 on preset initialize, and counts up over time.

I'm not sure how active this forum is anymore, but hopefully someone out there can point me in the right direction.

Thanks for your time.
mickmos is offline   Reply With Quote
Old 26th October 2018, 15:40   #2
Major Dude
Join Date: Mar 2008
Location: Erlangen
Posts: 937
Hi mickmos
That is easy: The preset initialisation section is executed once only, when the preset is started, while the per frame section is run each frame.

So set a variable in the initalisation section such as
t0 = time;

In the per frame section, time-t0 then gives you the running time. Similar with frames.

To display the value of any variable, use monitor in the per frame section:
monitor = time-t0;

You may also be interested in a very little known intrinsic variable named "progress". It starts with zero at preset start, and counts up; when it reaches one, the next preset will be loaded. I never used it, but it gives you the possibility to do something - maybe fade out - as the preset reaches its end.
That means that milkdrop knows the preset running time in advance. This time can be adjusted in the options.

Note - while editing a preset, you should disable the automatic preset change by activating numlock on the keyboard (if there IS a numlock key). The effect is that milkdrop will not change the preset while you are writing it. It does so by setting the preset running time to infinity: hence with numlock on, "progress" will always be indicated zero. That caught me a while ago, and made me think that this progress variable is buggy; it is not.

EDIT: It's the scroll lock button, not numlock.
Nitorami is offline   Reply With Quote
Old 29th October 2018, 08:41   #3
Junior Member
Join Date: Oct 2018
Posts: 2
Hey Nitorami thanks so much for the reply, this is exactly what I needed and you explained it all so well. Thanks for helping me with my first roadblock and hopefully have set me down a good road of making something cool with Milkdrop.
mickmos is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Visualizations > MilkDrop > MilkDrop Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump