Previous Thread
Next Thread
Print Thread
Variable refresh rates and m_frame_period #115805 09/05/19 05:30 PM
Joined: Feb 2014
Posts: 354
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 354
Hi guys,

I was trying an experiment with seeing if I could change the refresh rate on the fly.

In screen.h and screen.cpp there's a set_refresh_hz function that doesn't seem to have any effect.
Code
screen.set_refresh_hz(1.0);   // doesn't seem to do anything


However, if I write my own function to set the private member variable m_frame_period
Code
void screen_device::set_frame_period(attoseconds_t t){m_frame_period=t;}

and then call:
Code
screen.set_frame_period(HZ_TO_ATTOSECONDS( m_kbspecial->read() & 0x20 ? 60.0 : 5.0));  // change the refresh rate depending on a keypress

it seems to work as expected, pressing the SolidApple key (Rt Alt) will change the refresh to 60 fps, otherwise it will be 5 fps.

I just wanted to see if I could make my simulated printer "slow down" the refresh rate to save some cpu. When the printer is idle, it doesn't need to be refreshed all of the time.

There's two member variables, m_frame_period and m_refresh_rate and calling set_refresh only changes m_refresh.
Code
attoseconds_t       m_frame_period;        // attoseconds per frame
attoseconds_t       m_refresh;                  // default refresh period

void set_refresh(attoseconds_t rate) { m_refresh = rate; }

Re: Variable refresh rates and m_frame_period [Re: Golden Child] #115809 09/06/19 07:08 AM
Joined: May 2004
Posts: 890
D
Duke Offline
Senior Member
Offline
Senior Member
D
Joined: May 2004
Posts: 890
I'm not sure what set_refresh_hz() is supposed to do, but to dynamically change the refresh rate you can use configure().


Who's Online Now
3 registered members (Al Kossow, MAMEBase, zino), 190 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,714
Posts114,530
Members4,869
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3