Skip to content

Commit

Permalink
Synchronized Sync (Mode 2026) (#576)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ThatOneCalculator authored Sep 13, 2024
1 parent 395b36e commit f515f93
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ missing
version
config_file.h
.*
cava
8 changes: 5 additions & 3 deletions cava.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions example_files/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f515f93

Please sign in to comment.