From f515f9381e2b5b96b9c6acef2b79e02d86a5d3a0 Mon Sep 17 00:00:00 2001 From: Kainoa Kanter Date: Fri, 13 Sep 2024 16:56:08 -0300 Subject: [PATCH] Synchronized Sync (Mode 2026) (#576) * fix: use mode 2026 for sync updates * progress * add cava output to gitignore * it works now! * deprecate sync_updates * fix * end frame * synchronized_sync config option * fix: check for config properly --- .gitignore | 1 + cava.c | 8 +++++--- config.c | 4 ++-- example_files/config | 6 +++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 593a555..c1771bd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ missing version config_file.h .* +cava diff --git a/cava.c b/cava.c index ec4b688..aa20cea 100644 --- a/cava.c +++ b/cava.c @@ -1109,8 +1109,9 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co // output: draw processed input #ifdef NDEBUG if (p.sync_updates) { - printf("\033P=1s\033\\"); + printf("\033[2026h\033\\"); fflush(stdout); + printf("\033[2026l\033\\"); } int rc; #ifdef _MSC_VER @@ -1170,11 +1171,12 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co default: exit(EXIT_FAILURE); // Can't happen. } + if (p.sync_updates) { - printf("\033P=2s\033\\"); + printf("\033[2026h\033\\"); fflush(stdout); + printf("\033[2026l\033\\"); } - // terminal has been resized breaking to recalibrating values if (rc == -1) resizeTerminal = true; diff --git a/config.c b/config.c index dc5c4b9..93955ed 100644 --- a/config.c +++ b/config.c @@ -687,7 +687,7 @@ bool load_config(char configPath[PATH_MAX], struct config_params *p, bool colors p->waveform = iniparser_getint(ini, "output:waveform", 0); - p->sync_updates = iniparser_getint(ini, "output:alacritty_sync", 0); + p->sync_updates = iniparser_getint(ini, "output:synchronized_sync", 0); vertexShader = strdup(iniparser_getstring(ini, "output:vertex_shader", "pass_through.vert")); fragmentShader = @@ -832,7 +832,7 @@ bool load_config(char configPath[PATH_MAX], struct config_params *p, bool colors p->sdl_x = GetPrivateProfileInt("output", "sdl_x", -1, configPath); p->sdl_y = GetPrivateProfileInt("output", "sdl_y", -1, configPath); - p->sync_updates = GetPrivateProfileInt("output", "alacritty_sync", 0, configPath); + p->sync_updates = GetPrivateProfileInt("output", "synchronized_sync", 0, configPath); p->show_idle_bar_heads = GetPrivateProfileInt("output", "show_idle_bar_heads", 1, configPath); p->waveform = GetPrivateProfileInt("output", "waveform", 0, configPath); diff --git a/example_files/config b/example_files/config index c1789b4..5077f5a 100644 --- a/example_files/config +++ b/example_files/config @@ -189,11 +189,11 @@ # 'frequency' displays the lower cut off frequency of the bar above. # Only supported on ncurses and noncurses output. ; xaxis = none - -# enable alacritty synchronized updates. 1 = on, 0 = off + +# enable synchronized sync. 1 = on, 0 = off # removes flickering in alacritty terminal emulator. # defaults to off since the behaviour in other terminal emulators is unknown -; alacritty_sync = 0 +; synchronized_sync = 0 # Shaders for sdl_glsl, located in $HOME/.config/cava/shaders ; vertex_shader = pass_through.vert