Reflect FPS setting change immediately

This commit is contained in:
Duilio Protti 2016-06-25 15:28:00 -03:00
parent bdb9cf259d
commit 911fa7ba10
1 changed files with 16 additions and 14 deletions

View File

@ -23,6 +23,7 @@
#include <libaudcore/drct.h> #include <libaudcore/drct.h>
#include <libaudcore/playlist.h> #include <libaudcore/playlist.h>
#include <libaudcore/plugins.h> #include <libaudcore/plugins.h>
#include <libaudcore/runtime.h>
#include <audacious/audctrl.h> #include <audacious/audctrl.h>
#include <audacious/dbus.h> #include <audacious/dbus.h>
@ -421,6 +422,13 @@ static void check_events()
#endif /* INFINITY_DEBUG */ #endif /* INFINITY_DEBUG */
} }
// log calling line to improve bug reports
static gint32 calculate_frame_length(gint32 fps, int line) {
gint32 frame_length = frame_length = (gint32)(((1.0 / fps) * 1000));
g_message("Infinity[%d]: setting maximum rate at ~%d frames/second", line, fps);
return frame_length;
}
static int renderer(void *arg) static int renderer(void *arg)
{ {
gint32 render_time, now; gint32 render_time, now;
@ -428,10 +436,8 @@ static int renderer(void *arg)
gint32 idle_time; gint32 idle_time;
gint32 fps, new_fps; gint32 fps, new_fps;
/* We suppose here that config module have been initialized */ fps = aud_get_int(CFGID, "max_fps");
fps = config_get_fps(); frame_length = calculate_frame_length(fps, __LINE__);
frame_length = (gint32)((1.0 / config_get_fps()) * 1000);
g_message("Infinity[%d]: setting maximum rate at ~%d frames/second", __LINE__, fps);
initializing = FALSE; initializing = FALSE;
for (;; ) { /* ever... */ for (;; ) { /* ever... */
if (!visible) { if (!visible) {
@ -486,11 +492,10 @@ static int renderer(void *arg)
#endif #endif
} }
new_fps = config_get_fps(); new_fps = aud_get_int(CFGID, "max_fps");
if (new_fps != fps) { if (new_fps != fps) {
fps = new_fps; fps = new_fps;
frame_length = (gint32)(((1.0 / fps) * 1000)); frame_length = calculate_frame_length(fps, __LINE__);
g_message("Infinity[%d]: setting maximum rate at ~%d frames/second", __LINE__, fps);
} }
now = (gint32)SDL_GetTicks(); now = (gint32)SDL_GetTicks();
@ -509,10 +514,8 @@ static int renderer_mmx(void *arg)
gint32 idle_time; gint32 idle_time;
gint32 fps, new_fps; gint32 fps, new_fps;
/* We suppose here that config module have been initialized */ fps = aud_get_int(CFGID, "max_fps");
fps = config_get_fps(); frame_length = calculate_frame_length(fps, __LINE__);
frame_length = ((1.0 / fps) * 1000);
g_message("Infinity[%d]: setting maximum rate at ~%d frames/second", __LINE__, fps);
initializing = FALSE; initializing = FALSE;
for (;; ) { /* ever... */ for (;; ) { /* ever... */
if (!visible) { if (!visible) {
@ -567,11 +570,10 @@ static int renderer_mmx(void *arg)
#endif #endif
} }
new_fps = config_get_fps(); new_fps = aud_get_int(CFGID, "max_fps");
if (new_fps != fps) { if (new_fps != fps) {
fps = new_fps; fps = new_fps;
frame_length = ((1.0 / fps) * 1000); frame_length = calculate_frame_length(fps, __LINE__);
g_message("Infinity[%d]: setting maximum rate at ~%d frames/second", __LINE__, fps);
} }
now = SDL_GetTicks(); now = SDL_GetTicks();