From 585881113e4032332116d154673492aaaa55bff7 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 8 May 2018 00:04:49 -0400 Subject: [PATCH] add autolimitingo --- colorchord2/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/colorchord2/main.c b/colorchord2/main.c index 5d782ac..981df57 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -49,6 +49,7 @@ int set_screenx = 640; REGISTER_PARAM( set_screenx, PAINT ); int set_screeny = 480; REGISTER_PARAM( set_screeny, PAINT ); char sound_source[16]; REGISTER_PARAM( sound_source, PABUFFER ); int cpu_autolimit = 1; REGISTER_PARAM( cpu_autolimit, PAINT ); +float cpu_autolimit_interval = 0.016; REGISTER_PARAM( cpu_autolimit_interval, PAFLOAT ); int sample_channel = -1;REGISTER_PARAM( sample_channel, PAINT ); int showfps = 0; REGISTER_PARAM( showfps, PAINT ); @@ -432,8 +433,8 @@ int main(int argc, char ** argv) if( cpu_autolimit ) { - SecToWait = .016 - ( ThisTime - LastFrameTime ); - LastFrameTime += .016; + SecToWait = cpu_autolimit_interval - ( ThisTime - LastFrameTime ); + LastFrameTime += cpu_autolimit_interval; if( SecToWait < -.1 ) LastFrameTime = ThisTime - .1; if( SecToWait > 0 ) OGUSleep( (int)( SecToWait * 1000000 ) );