Old 14th March 2004, 10:10   #1
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Thumbs up getframerate()

I really would find a function that gets the current framerate very useful. The purpose of course would be to make the presets "run" faster/slower depending on the framerate. Sure you can nowadays use gettime, but the method with that seems to me a bit complicated, with getframerate it could be as easy as: time=time+speed/getframerate()
this would really help the less advanced people like myself to make presets run at correct speed depending on the framerate.
Also there would be no more need for framerate limiter ape i think

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 14th March 2004, 12:37   #2
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
True dat Tuggummi. I'm messing around with getting time indpendent movement because the presets I make on my 700 system run pretty damn fast on my 2k system

You wouldn't even need a function, just a varible like b or i. AVS already keeps track of it, just drop it in.

Stoke me a clipper. I'll be back for Christmas.

- Arnold Rimmer
Red Dwarf
Jaheckelsafar is offline   Reply With Quote
Old 14th March 2004, 13:36   #3
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
How is the current method harder than what you said?

time=gettime(0);framerate=1/(time-ltime);ltime=time;

UnConeD is offline   Reply With Quote
Old 14th March 2004, 19:11   #4
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Quote:
would help less advanced people
I can't even understand how is that method you posted suppose to work...

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 14th March 2004, 20:50   #5
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Frames = frames per second

time between current frame and last frame = seconds per frame.

Better now?

UnConeD is offline   Reply With Quote
Old 14th March 2004, 22:10   #6
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
Quote:
time=gettime(0);framerate=1/(time-ltime);ltime=time;
Uhm where is the time difference then? Well in theory there must be a 0.000001ms time difference between when the code is executed, yet i fail to understand how it's suppose measure the framerate or make presets framerate independent.

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Old 15th March 2004, 01:55   #7
Nic01
Major Dude
 
Nic01's Avatar
 
Join Date: Mar 2002
Location: The Biggest Little City
Posts: 508
Send a message via AIM to Nic01
The time is in ltime in the end. If you've tried pre-megabuf progression, you'll know how it works (I believe Skupers made something of this sort)

[soon to leave, sirs]
Nic01 is offline   Reply With Quote
Old 15th March 2004, 02:16   #8
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
Here is an easier to read piece of code:

changeintime = gettime(lasttime); // here lasttime is what was set last frame
lasttime = gettime(0);

framerate = 1/changeintime;

the method is the same i just thought it would be clearer like this

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 15th March 2004, 02:30   #9
S-uper_T-oast
Forum King
 
S-uper_T-oast's Avatar
 
Join Date: May 2003
Location: Fnord?!
Posts: 2,657
Explanation
(all goes in the perframe section)
time=gettime(0); //sets time to the current time

secondsperframe=time-ltime; //calculates the seconds perframe by subtracting the current time from the last time

framespersecond=1/secondsperframe;//calculates the frames per second by dividing 1 by the number of seconds per frame

ltime=time; sets ltime to the current time for the next frame

That can all be simplified to-
ltime=gettime(0);
fps=1/(time-ltime);
ltime=time;
S-uper_T-oast is offline   Reply With Quote
Old 15th March 2004, 07:53   #10
Jaheckelsafar
Major Dude
 
Join Date: Feb 2002
Location: home
Posts: 1,318
Regardless, AVS keeps track of the fps. Why not use it in the next release (hoping against hope)

Stoke me a clipper. I'll be back for Christmas.

- Arnold Rimmer
Red Dwarf
Jaheckelsafar is offline   Reply With Quote
Old 15th March 2004, 11:33   #11
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Because this is more accurate of course. AVS' counter only refreshes every second or so. Using this snippet you can catch sudden changes in FPS, I needed that for e.g. Tokyo Bullet.

UnConeD is offline   Reply With Quote
Old 17th March 2004, 09:07   #12
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
If you need a framerate limiter, try this SSC:

Init:
code:

n=0; ncalib=100;
//calibrate to fit your cpu
t=gettime(0);
loop(ncalib,
loop(1000,
exp(1.1)
)
);
tcalib=gettime(0)-t;

t=gettime(0);



Frame:
code:

//calculate currentframe length
lastt=t;
t=gettime(0);
distt=t-lastt;
//and maximum frame length
maxt=max(maxt,distt);
//calculate needed loops to achieve frame length
a=(maxt-distt)/tcalib*ncalib;
//and loop often enough to fill the rest of the frame
loop(a,
loop(1000,
exp(1.1)
)
);
//get t for distance to next frame
t=gettime(0);



Beat:
code:

//reset Maximum frame length on beat,
//in case it got screwed up
maxt=distt;



Add this SSC at the end of your preset and you have an almost constant FPS around the lowest FPS your preset had before.
TomyLobo is offline   Reply With Quote
Old 7th April 2004, 23:26   #13
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
that's completely offtopic...

and i second ucd, there's no point in a getframerate function/variable. the code really isn't that hard to work out :\

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 8th April 2004, 01:41   #14
hungryskull
Major Dude
 
hungryskull's Avatar
 
Join Date: Feb 2003
Location: Somewhere in Canada
Posts: 776
It may not be hard, but it's 3 lines of extra code that isn't needed. He wants it for the sake of simplicity, not because he can't do it with code.

Darn, I can't think of anything to put here.
hungryskull is offline   Reply With Quote
Old 8th April 2004, 04:08   #15
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
that was not off-topic
Quote:
Also there would be no more need for framerate limiter ape i think
i replied to that and posted my framerate limiter SSC to point out that you dont need an APE for that

besides: i also agree with unconed, i never neede a getframerate function anywhere. it's plain useless: this function would calculate the framerate from the frame time(or take a value that's calculated this way) and most times you'd need to divide something by the framerate, which is slow and adding to that, it's converting something back and forth...

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 8th April 2004, 16:39   #16
D12
Banned
 
D12's Avatar
 
Join Date: Apr 2004
Location: Blood
Posts: 42
Send a message via ICQ to D12 Send a message via AIM to D12 Send a message via Yahoo to D12
Any time between frame rate I think give frame per second.
I mean there is relationship between second time & frame rates.
D12 is offline   Reply With Quote
Old 26th April 2004, 09:46   #17
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
what about using getframe() in a ssc code or a dynamic movement, you could make it become less dense if your framerate dropped or something like that.

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 26th April 2004, 12:04   #18
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
there is no getframe() and i don't think it's ever going to be implemented
use the usual method
t=gettime(0);
timesincelastframe=lastframet-t;
lastframet=t

making an SSC or a DM less dense to compensate framerate dropdowns is a good idea though... if only one could set the DM gridsize by code
this method should work with SSC, though.

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote
Old 27th April 2004, 05:25   #19
Tuggummi
Bin King
 
Tuggummi's Avatar
 
Join Date: Mar 2001
Location: Finland
Posts: 2,173
When i posted this i didn't know better, now i have seen the light...

Lock it please.

Texer Resources

Im retarded... err i mean retired!
Probably both...
Tuggummi is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS > AVS Wishlist

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