Hello community,

here is the log from the commit of package cava for openSUSE:Factory checked in 
at 2020-06-25 15:09:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cava (Old)
 and      /work/SRC/openSUSE:Factory/.cava.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cava"

Thu Jun 25 15:09:09 2020 rev:7 rq:816962 version:0.7.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/cava/cava.changes        2020-05-28 
09:21:51.669491384 +0200
+++ /work/SRC/openSUSE:Factory/.cava.new.3060/cava.changes      2020-06-25 
15:10:42.069981511 +0200
@@ -1,0 +2,11 @@
+Thu Jun 25 07:03:38 UTC 2020 - Michael Vetter <[email protected]>
+
+- Update to 0.7.1:
+  improvements:
+  * set default gradient colors instead of exiting when not defined.
+  bugfixes:
+  * minor memory leak in ncurses
+  * fix warnings when building on macos
+  * updated macos building instructions
+
+-------------------------------------------------------------------

Old:
----
  0.7.0.tar.gz

New:
----
  0.7.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cava.spec ++++++
--- /var/tmp/diff_new_pack.dRp9mf/_old  2020-06-25 15:10:43.341985502 +0200
+++ /var/tmp/diff_new_pack.dRp9mf/_new  2020-06-25 15:10:43.345985515 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           cava
-Version:        0.7.0
+Version:        0.7.1
 Release:        0
 Summary:        Console-based Audio Visualizer for Alsa
 License:        MIT

++++++ 0.7.0.tar.gz -> 0.7.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/Makefile.am new/cava-0.7.1/Makefile.am
--- old/cava-0.7.0/Makefile.am  2020-05-26 22:29:47.000000000 +0200
+++ new/cava-0.7.1/Makefile.am  2020-06-24 21:18:09.000000000 +0200
@@ -13,8 +13,8 @@
                output/terminal_noncurses.c output/raw.c
 cava_LDFLAGS = -L/usr/local/lib -Wl,-rpath /usr/local/lib
 cava_CPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\" \
-           -D_POSIX_SOURCE -D _POSIX_C_SOURCE=200809L
-cava_CFLAGS = -std=c99 -Wall -Wextra -Wno-unused-result 
-Wno-maybe-uninitialized 
+           -D_POSIX_SOURCE -D _POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE_EXTENDED
+cava_CFLAGS = -std=c99 -Wall -Werror -Wextra -Wno-unused-result 
-Wno-unknown-warning-option -Wno-maybe-uninitialized
 
 if OSX
     cava_CFLAGS += -DNORT
@@ -39,7 +39,7 @@
 endif
 
 if NCURSES
-    cava_SOURCES += output/terminal_bcircle.c output/terminal_ncurses.c
+    cava_SOURCES += output/terminal_ncurses.c
 endif
 
 cava_font_dir = @FONT_DIR@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/README.md new/cava-0.7.1/README.md
--- old/cava-0.7.0/README.md    2020-05-26 22:29:47.000000000 +0200
+++ new/cava-0.7.1/README.md    2020-06-24 21:18:09.000000000 +0200
@@ -131,7 +131,7 @@
 
     export LIBTOOL=`which glibtool`
     export LIBTOOLIZE=`which glibtoolize`
-    ln -s `which glibtoolize` libtoolize
+    ln -s `which glibtoolize` /usr/local/bin/libtoolize
     ln -s /usr/lib/libncurses.dylib /usr/local/lib/libncursesw.dylib
 
 Tested on macOS High Sierra.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/autogen.sh new/cava-0.7.1/autogen.sh
--- old/cava-0.7.0/autogen.sh   2020-05-26 22:29:47.000000000 +0200
+++ new/cava-0.7.1/autogen.sh   2020-06-24 21:18:09.000000000 +0200
@@ -3,7 +3,7 @@
 if [ -d .git ]; then
   git describe --always --tags --dirty > version # get version from git
 else
-  echo 0.6.1 > version # hard coded versions
+  echo 0.7.1 > version # hard coded versions
 fi
 
 libtoolize
@@ -16,4 +16,4 @@
 if [ -z "$XDG_CONFIG_HOME" ]; then CONFIGDIR=$HOME/.config/cava; fi
 
 mkdir -p "$CONFIGDIR"
-cp -n example_files/config "$CONFIGDIR"/config
+[ -f "$CONFIGDIR"/config ] || cp example_files/config "$CONFIGDIR"/config
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/cava.c new/cava-0.7.1/cava.c
--- old/cava-0.7.0/cava.c       2020-05-26 22:29:47.000000000 +0200
+++ new/cava-0.7.1/cava.c       2020-06-24 21:18:09.000000000 +0200
@@ -1,4 +1,3 @@
-#define _XOPEN_SOURCE_EXTENDED
 #include <locale.h>
 
 #ifdef HAVE_ALLOCA_H
@@ -549,7 +548,7 @@
 #endif
             case OUTPUT_NONCURSES:
                 get_terminal_dim_noncurses(&width, &lines);
-                init_terminal_noncurses(p.col, p.bgcol, width, lines, 
p.bar_width);
+                init_terminal_noncurses(inAtty, p.col, p.bgcol, width, lines, 
p.bar_width);
                 height = (lines - 1) * 8;
                 break;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/config.c new/cava-0.7.1/config.c
--- old/cava-0.7.0/config.c     2020-05-26 22:29:47.000000000 +0200
+++ new/cava-0.7.1/config.c     2020-06-24 21:18:09.000000000 +0200
@@ -322,7 +322,7 @@
         for (int i = 0; i < p->gradient_count; ++i) {
             free(p->gradient_colors[i]);
         }
-        p->gradient_count = iniparser_getint(ini, "color:gradient_count", 2);
+        p->gradient_count = iniparser_getint(ini, "color:gradient_count", 8);
         if (p->gradient_count < 2) {
             write_errorf(error, "\nAtleast two colors must be given as 
gradient!\n");
             return false;
@@ -331,20 +331,23 @@
             write_errorf(error, "\nMaximum 8 colors can be specified as 
gradient!\n");
             return false;
         }
-        p->gradient_colors = (char **)malloc(sizeof(char *) * 
p->gradient_count);
-        for (int i = 0; i < p->gradient_count; i++) {
-            char ini_config[32];
-            sprintf(ini_config, "color:gradient_color_%d", (i + 1));
-            p->gradient_colors[i] = strdup(iniparser_getstring(ini, 
ini_config, NULL));
-            if (p->gradient_colors[i] == NULL) {
-                write_errorf(error, "\nGradient color not specified : 
gradient_color_%d\n",
-                             (i + 1));
-                return false;
-            }
-        }
-        // p->gradient_color_1 = (char *)iniparser_getstring(ini, 
"color:gradient_color_1",
-        // "#0099ff"); p->gradient_color_2 = (char *)iniparser_getstring(ini,
-        // "color:gradient_color_2", "#ff3399");
+        p->gradient_colors = (char **)malloc(sizeof(char *) * 
p->gradient_count * 9);
+        p->gradient_colors[0] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_1", 
"#59cc33"));
+        p->gradient_colors[1] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_2", 
"#80cc33"));
+        p->gradient_colors[2] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_3", 
"#a6cc33"));
+        p->gradient_colors[3] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_4", 
"#cccc33"));
+        p->gradient_colors[4] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_5", 
"#cca633"));
+        p->gradient_colors[5] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_6", 
"#cc8033"));
+        p->gradient_colors[6] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_7", 
"#cc5933"));
+        p->gradient_colors[7] =
+            strdup(iniparser_getstring(ini, "color:gradient_color_8", 
"#cc3333"));
     }
     return true;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/example_files/config 
new/cava-0.7.1/example_files/config
--- old/cava-0.7.0/example_files/config 2020-05-26 22:29:47.000000000 +0200
+++ new/cava-0.7.1/example_files/config 2020-06-24 21:18:09.000000000 +0200
@@ -120,13 +120,19 @@
 ; background = default
 ; foreground = default
 
-# Gradient mode, only hex defined colors are supported, background must also 
be defined in hex
-# or remain commented out. 1 = on, 0 = off. Warning: for certain terminal 
emulators cava will
-# not able to restore color definitions on exit, simply restart your terminal 
to restore colors.
+# Gradient mode, only hex defined colors (and thereby ncurses mode) are 
supported,
+# background must also be defined in hex  or remain commented out. 1 = on, 0 = 
off.
+# You can define as many as 8 different colors. They range from bottom to top 
of screen
 ; gradient = 1
-; gradient_count = 2
-; gradient_color_1 = '#0099ff'
-; gradient_color_2 = '#ff3399'
+; gradient_count = 8
+; gradient_color_1 = '#59cc33'
+; gradient_color_2 = '#80cc33'
+; gradient_color_3 = '#a6cc33'
+; gradient_color_4 = '#cccc33'
+; gradient_color_5 = '#cca633'
+; gradient_color_6 = '#cc8033'
+; gradient_color_7 = '#cc5933'
+; gradient_color_8 = '#cc3333'
 
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/input/portaudio.c 
new/cava-0.7.1/input/portaudio.c
--- old/cava-0.7.0/input/portaudio.c    2020-05-26 22:29:47.000000000 +0200
+++ new/cava-0.7.1/input/portaudio.c    2020-06-24 21:18:09.000000000 +0200
@@ -4,7 +4,7 @@
 #include <portaudio.h>
 #define PORTBUFSIZE 512
 
-#define SAMPLE_SILENCE 32768
+#define SAMPLE_SILENCE -32767
 #define PA_SAMPLE_TYPE paInt16
 typedef short SAMPLE;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/output/terminal_noncurses.c 
new/cava-0.7.1/output/terminal_noncurses.c
--- old/cava-0.7.0/output/terminal_noncurses.c  2020-05-26 22:29:47.000000000 
+0200
+++ new/cava-0.7.1/output/terminal_noncurses.c  2020-06-24 21:18:09.000000000 
+0200
@@ -8,13 +8,13 @@
 #include <unistd.h>
 #include <wchar.h>
 
-wchar_t *line_buffer;
+wchar_t *frame_buffer;
 wchar_t *barstring[8];
-wchar_t *wspacestring;
+wchar_t *spacestring;
 int buf_length;
-char *ttyline_buffer;
-char ttybarstring[8][100];
-char ttyspacestring[100];
+char *ttyframe_buffer;
+char *ttybarstring[8];
+char *ttyspacestring;
 int ttybuf_length;
 
 int setecho(int fd, int onoff) {
@@ -35,50 +35,60 @@
     return 0;
 }
 
-int init_terminal_noncurses(int col, int bgcol, int w, int h, int bar_width) {
+int init_terminal_noncurses(int tty, int col, int bgcol, int width, int lines, 
int bar_width) {
 
-    int n, i;
-
-    ttybuf_length = sizeof(char) * w * h * 10;
-    ttyline_buffer = (char *)malloc(ttybuf_length);
+    if (tty) {
 
-    buf_length = sizeof(wchar_t) * w * h * 10;
-    line_buffer = (wchar_t *)malloc(buf_length);
-    wspacestring = (wchar_t *)malloc(sizeof(wchar_t) * bar_width);
-
-    // clearing barstrings
-    for (n = 0; n < 8; n++) {
-        barstring[n] = (wchar_t *)malloc(sizeof(wchar_t) * bar_width);
-        ttybarstring[n][0] = '\0';
-        barstring[n][0] = '\0';
+        ttybuf_length = sizeof(char) * width * lines * 10;
+        ttyframe_buffer = (char *)malloc(ttybuf_length);
+        ttyspacestring = (char *)malloc(sizeof(char) * bar_width);
+
+        // clearing barstrings
+        for (int n = 0; n < 8; n++) {
+            ttybarstring[n] = (char *)malloc(sizeof(char) * bar_width);
+            ttybarstring[n][0] = '\0';
+        }
         ttyspacestring[0] = '\0';
-    }
-    wspacestring[0] = '\0';
-    line_buffer[0] = '\0';
-    ttyline_buffer[0] = '\0';
-
-    // creating barstrings for drawing
-    for (n = 0; n < bar_width; n++) {
-
-        wcscat(barstring[0], L"\u2588");
-        wcscat(barstring[1], L"\u2581");
-        wcscat(barstring[2], L"\u2582");
-        wcscat(barstring[3], L"\u2583");
-        wcscat(barstring[4], L"\u2584");
-        wcscat(barstring[5], L"\u2585");
-        wcscat(barstring[6], L"\u2586");
-        wcscat(barstring[7], L"\u2587");
-        wcscat(wspacestring, L" ");
-
-        strcat(ttybarstring[0], "8");
-        strcat(ttybarstring[1], "1");
-        strcat(ttybarstring[2], "2");
-        strcat(ttybarstring[3], "3");
-        strcat(ttybarstring[4], "4");
-        strcat(ttybarstring[5], "5");
-        strcat(ttybarstring[6], "6");
-        strcat(ttybarstring[7], "7");
-        strcat(ttyspacestring, " ");
+        ttyframe_buffer[0] = '\0';
+
+        // creating barstrings for drawing
+        for (int n = 0; n < bar_width; n++) {
+            strcat(ttybarstring[0], "8");
+            strcat(ttybarstring[1], "1");
+            strcat(ttybarstring[2], "2");
+            strcat(ttybarstring[3], "3");
+            strcat(ttybarstring[4], "4");
+            strcat(ttybarstring[5], "5");
+            strcat(ttybarstring[6], "6");
+            strcat(ttybarstring[7], "7");
+            strcat(ttyspacestring, " ");
+        }
+    } else if (!tty) {
+
+        buf_length = sizeof(wchar_t) * width * lines * 10;
+        frame_buffer = (wchar_t *)malloc(buf_length);
+        spacestring = (wchar_t *)malloc(sizeof(wchar_t) * bar_width);
+
+        // clearing barstrings
+        for (int n = 0; n < 8; n++) {
+            barstring[n] = (wchar_t *)malloc(sizeof(wchar_t) * bar_width);
+            barstring[n][0] = '\0';
+        }
+        spacestring[0] = '\0';
+        frame_buffer[0] = '\0';
+
+        // creating barstrings for drawing
+        for (int n = 0; n < bar_width; n++) {
+            wcscat(barstring[0], L"\u2588");
+            wcscat(barstring[1], L"\u2581");
+            wcscat(barstring[2], L"\u2582");
+            wcscat(barstring[3], L"\u2583");
+            wcscat(barstring[4], L"\u2584");
+            wcscat(barstring[5], L"\u2585");
+            wcscat(barstring[6], L"\u2586");
+            wcscat(barstring[7], L"\u2587");
+            wcscat(spacestring, L" ");
+        }
     }
 
     col += 30;
@@ -100,14 +110,14 @@
         bgcol += 40;
         printf("\033[%dm", bgcol);
 
-        for (n = (h); n >= 0; n--) {
-            for (i = 0; i < w; i++) {
+        for (int n = (lines); n >= 0; n--) {
+            for (int i = 0; i < width; i++) {
 
                 printf(" "); // setting backround color
             }
             printf("\n");
         }
-        printf("\033[%dA", h); // moving cursor back up
+        printf("\033[%dA", lines); // moving cursor back up
     }
 
     setecho(STDIN_FILENO, 0);
@@ -115,170 +125,158 @@
     return 0;
 }
 
-void get_terminal_dim_noncurses(int *w, int *h) {
+void get_terminal_dim_noncurses(int *width, int *lines) {
 
     struct winsize dim;
 
     ioctl(STDOUT_FILENO, TIOCGWINSZ, &dim);
 
-    *h = (int)dim.ws_row;
-    *w = (int)dim.ws_col;
+    *lines = (int)dim.ws_row;
+    *width = (int)dim.ws_col;
 
     system("clear"); // clearing in case of resieze
 }
 
-int draw_terminal_noncurses(int tty, int h, int w, int bars, int bar_width, 
int bs, int rest,
-                            int f[200], int flastd[200]) {
-    int current_char, last_char, n, o, same_line, new_line, cx;
+int draw_terminal_noncurses(int tty, int lines, int width, int number_of_bars, 
int bar_width,
+                            int bar_spacing, int rest, int bars[200], int 
previous_frame[200]) {
+
+    int current_cell, prev_cell, same_line, new_line, cx;
 
     struct winsize dim;
 
     same_line = 0;
     new_line = 0;
     cx = 0;
+    if (!tty) {
 
-    if (tty) {
+        // output: check if terminal has been resized
+        ioctl(STDOUT_FILENO, TIOCGWINSZ, &dim);
+
+        if ((int)dim.ws_row != lines || (int)dim.ws_col != width) {
+            free(frame_buffer);
+            free(spacestring);
+            for (int i = 0; i < 8; i++)
+                free(barstring[i]);
 
-        ttyline_buffer[0] = '\0';
+            return -1;
+        }
+    }
+    if (tty)
+        ttyframe_buffer[0] = '\0';
+    else if (!tty)
+        frame_buffer[0] = '\0';
 
-        for (n = h - 1; n >= 0; n--) {
+    for (int current_line = lines - 1; current_line >= 0; current_line--) {
 
-            int same_bar = 0;
-            int center_adjusted = 0;
+        int same_bar = 0;
+        int center_adjusted = 0;
 
-            for (o = 0; o < bars; o++) {
+        for (int i = 0; i < number_of_bars; i++) {
 
-                current_char = f[o] - n * 8;
-                last_char = flastd[o] - n * 8;
+            current_cell = bars[i] - current_line * 8;
+            prev_cell = previous_frame[i] - current_line * 8;
 
-                // same as last frame
-                if ((current_char < 1 && last_char < 1) || (current_char > 7 
&& last_char > 7) ||
-                    (current_char == last_char)) {
-                    same_bar++;
-                } else {
+            // same as last frame
+            if ((current_cell < 1 && prev_cell < 1) || (current_cell > 7 && 
prev_cell > 7) ||
+                (current_cell == prev_cell)) {
+                same_bar++;
+            } else {
+                if (tty) {
                     if (same_line > 0) {
-                        cx += snprintf(ttyline_buffer + cx, ttybuf_length - 
cx, "\033[%dB",
+                        cx += snprintf(ttyframe_buffer + cx, ttybuf_length - 
cx, "\033[%dB",
                                        same_line); // move down
                         new_line += same_line;
                         same_line = 0;
                     }
 
                     if (same_bar > 0) {
-                        cx += snprintf(ttyline_buffer + cx, ttybuf_length - 
cx, "\033[%dC",
-                                       (bar_width + bs) * same_bar); // move 
forward
+                        cx += snprintf(ttyframe_buffer + cx, ttybuf_length - 
cx, "\033[%dC",
+                                       (bar_width + bar_spacing) * same_bar); 
// move forward
                         same_bar = 0;
                     }
 
                     if (!center_adjusted) {
-                        cx += snprintf(ttyline_buffer + cx, ttybuf_length - 
cx, "\033[%dC", rest);
+                        cx += snprintf(ttyframe_buffer + cx, ttybuf_length - 
cx, "\033[%dC", rest);
                         center_adjusted = 1;
                     }
 
-                    if (current_char < 1)
-                        cx += snprintf(ttyline_buffer + cx, ttybuf_length - 
cx, ttyspacestring);
-                    else if (current_char > 7)
-                        cx += snprintf(ttyline_buffer + cx, ttybuf_length - 
cx, ttybarstring[0]);
+                    if (current_cell < 1)
+                        cx += snprintf(ttyframe_buffer + cx, ttybuf_length - 
cx, "%s",
+                                       ttyspacestring);
+                    else if (current_cell > 7)
+                        cx += snprintf(ttyframe_buffer + cx, ttybuf_length - 
cx, "%s",
+                                       ttybarstring[0]);
                     else
-                        cx += snprintf(ttyline_buffer + cx, ttybuf_length - cx,
-                                       ttybarstring[current_char]);
-
-                    cx += snprintf(ttyline_buffer + cx, ttybuf_length - cx, 
"\033[%dC", bs);
-                }
-            }
+                        cx += snprintf(ttyframe_buffer + cx, ttybuf_length - 
cx, "%s",
+                                       ttybarstring[current_cell]);
 
-            if (same_bar != bars) {
-                if (n != 0) {
-                    cx += snprintf(ttyline_buffer + cx, ttybuf_length - cx, 
"\n");
-                    new_line++;
-                }
-            } else {
-                same_line++;
-            }
-        }
-        if (same_line != h) {
-            printf("%s\r\033[%dA", ttyline_buffer,
-                   new_line); //\r\033[%dA", ttyline_buffer,  h - same_line);
-            fflush(stdout);
-        }
-    } else if (!tty) {
-
-        // output: check if terminal has been resized
-        ioctl(STDOUT_FILENO, TIOCGWINSZ, &dim);
-
-        if ((int)dim.ws_row != h || (int)dim.ws_col != w) {
-            free(line_buffer);
-            free(wspacestring);
-            for (int i = 0; i < 8; i++)
-                free(barstring[i]);
-            return -1;
-        }
-
-        line_buffer[0] = '\0';
-
-        for (n = h - 1; n >= 0; n--) {
-
-            int same_bar = 0;
-            int center_adjusted = 0;
-
-            for (o = 0; o < bars; o++) {
-
-                current_char = f[o] - n * 8;
-                last_char = flastd[o] - n * 8;
-
-                // same as last frame
-                if ((current_char < 1 && last_char < 1) || (current_char > 7 
&& last_char > 7) ||
-                    (current_char == last_char)) {
-                    same_bar++;
-                } else {
+                    cx +=
+                        snprintf(ttyframe_buffer + cx, ttybuf_length - cx, 
"\033[%dC", bar_spacing);
+                } else if (!tty) {
                     if (same_line > 0) {
-                        cx += swprintf(line_buffer + cx, buf_length - cx, 
L"\033[%dB",
+                        cx += swprintf(frame_buffer + cx, buf_length - cx, 
L"\033[%dB",
                                        same_line); // move down
                         new_line += same_line;
                         same_line = 0;
                     }
 
                     if (same_bar > 0) {
-                        cx += swprintf(line_buffer + cx, buf_length - cx, 
L"\033[%dC",
-                                       (bar_width + bs) * same_bar); // move 
forward
+                        cx += swprintf(frame_buffer + cx, buf_length - cx, 
L"\033[%dC",
+                                       (bar_width + bar_spacing) * same_bar); 
// move forward
                         same_bar = 0;
                     }
 
                     if (!center_adjusted && rest) {
-                        cx += swprintf(line_buffer + cx, buf_length - cx, 
L"\033[%dC", rest);
+                        cx += swprintf(frame_buffer + cx, buf_length - cx, 
L"\033[%dC", rest);
                         center_adjusted = 1;
                     }
 
-                    if (current_char < 1)
-                        cx += swprintf(line_buffer + cx, buf_length - cx, 
wspacestring);
-                    else if (current_char > 7)
-                        cx += swprintf(line_buffer + cx, buf_length - cx, 
barstring[0]);
+                    if (current_cell < 1)
+                        cx += swprintf(frame_buffer + cx, buf_length - cx, 
spacestring);
+                    else if (current_cell > 7)
+                        cx += swprintf(frame_buffer + cx, buf_length - cx, 
barstring[0]);
                     else
-                        cx += swprintf(line_buffer + cx, buf_length - cx, 
barstring[current_char]);
+                        cx += swprintf(frame_buffer + cx, buf_length - cx, 
barstring[current_cell]);
 
-                    cx += swprintf(line_buffer + cx, buf_length - cx, 
L"\033[%dC", bs);
+                    cx += swprintf(frame_buffer + cx, buf_length - cx, 
L"\033[%dC", bar_spacing);
                 }
             }
+        }
 
-            if (same_bar != bars) {
-                if (n != 0) {
-                    cx += swprintf(line_buffer + cx, buf_length - cx, L"\n");
-                    new_line++;
-                }
-            } else {
-                same_line++;
+        if (same_bar != number_of_bars) {
+            if (current_line != 0) {
+                if (tty)
+                    cx += snprintf(ttyframe_buffer + cx, ttybuf_length - cx, 
"\n");
+                else if (!tty)
+                    cx += swprintf(frame_buffer + cx, buf_length - cx, L"\n");
+
+                new_line++;
             }
-        }
-        if (same_line != h) {
-            printf("%ls\r\033[%dA", line_buffer,
-                   new_line); //\r\033[%dA", line_buffer,  h - same_line);
-            fflush(stdout);
+        } else {
+            same_line++;
         }
     }
+    if (same_line != lines) {
+        if (tty)
+            printf("%s\r\033[%dA", ttyframe_buffer, new_line);
+        else if (!tty)
+            printf("%ls\r\033[%dA", frame_buffer, new_line);
+
+        fflush(stdout);
+    }
     return 0;
 }
 
 // general: cleanup
 void cleanup_terminal_noncurses(void) {
+    free(frame_buffer);
+    free(ttyframe_buffer);
+    free(spacestring);
+    free(ttyspacestring);
+    for (int i = 0; i < 8; i++) {
+        free(barstring[i]);
+        free(ttybarstring[i]);
+    }
     setecho(STDIN_FILENO, 1);
     printf("\033[0m\n");
     system("setfont  >/dev/null 2>&1");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.0/output/terminal_noncurses.h 
new/cava-0.7.1/output/terminal_noncurses.h
--- old/cava-0.7.0/output/terminal_noncurses.h  2020-05-26 22:29:47.000000000 
+0200
+++ new/cava-0.7.1/output/terminal_noncurses.h  2020-06-24 21:18:09.000000000 
+0200
@@ -1,4 +1,4 @@
-int init_terminal_noncurses(int col, int bgcol, int w, int h, int bar_width);
+int init_terminal_noncurses(int tty, int col, int bgcol, int w, int h, int 
bar_width);
 void get_terminal_dim_noncurses(int *w, int *h);
 int draw_terminal_noncurses(int virt, int height, int width, int bars, int 
bar_width, int bs,
                             int rest, int f[200], int flastd[200]);


Reply via email to