Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package cava for openSUSE:Factory checked in 
at 2021-05-19 17:49:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cava (Old)
 and      /work/SRC/openSUSE:Factory/.cava.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cava"

Wed May 19 17:49:27 2021 rev:10 rq:894224 version:0.7.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/cava/cava.changes        2020-10-08 
13:14:44.643311490 +0200
+++ /work/SRC/openSUSE:Factory/.cava.new.2988/cava.changes      2021-05-19 
17:49:38.301469664 +0200
@@ -1,0 +2,10 @@
+Wed May 19 06:52:53 UTC 2021 - Michael Vetter <mvet...@suse.com>
+
+- Update to 0.7.4:
+  improvements:
+  * added faster autosens at startup
+  bugfixes:
+  * better installation of custom console font
+  * suppress error about vla parameter introduced in gcc11 or 10?
+
+-------------------------------------------------------------------

Old:
----
  0.7.3.tar.gz

New:
----
  0.7.4.tar.gz

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

Other differences:
------------------
++++++ cava.spec ++++++
--- /var/tmp/diff_new_pack.ozcFk3/_old  2021-05-19 17:49:39.165466040 +0200
+++ /var/tmp/diff_new_pack.ozcFk3/_new  2021-05-19 17:49:39.169466023 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package cava
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           cava
-Version:        0.7.3
+Version:        0.7.4
 Release:        0
 Summary:        Console-based Audio Visualizer for Alsa
 License:        MIT

++++++ 0.7.3.tar.gz -> 0.7.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/Makefile.am new/cava-0.7.4/Makefile.am
--- old/cava-0.7.3/Makefile.am  2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/Makefile.am  2021-05-18 20:13:38.000000000 +0200
@@ -13,8 +13,9 @@
                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 -D_XOPEN_SOURCE_EXTENDED
-cava_CFLAGS = -std=c99 -Wall -Werror -Wextra -Wno-unused-result 
-Wno-unknown-warning-option -Wno-maybe-uninitialized
+           -D_POSIX_SOURCE -D _POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE_EXTENDED 
\
+          -DFONTDIR=\"@FONT_DIR@\"
+cava_CFLAGS = -std=c99 -Wall -Werror -Wextra -Wno-unused-result 
-Wno-unknown-warning-option -Wno-maybe-uninitialized -Wno-vla-parameter
 
 if OSX
     cava_CFLAGS += -DNORT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/README.md new/cava-0.7.4/README.md
--- old/cava-0.7.3/README.md    2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/README.md    2021-05-18 20:13:38.000000000 +0200
@@ -28,15 +28,15 @@
     - [openSUSE](#opensuse)
     - [Fedora](#fedora)
     - [Arch](#arch)
-    - [Ubuntu](#ubuntu)
-    - [Debian (unstable)](#debian-unstable)
+    - [Ubuntu/Debian](#ubuntudebian)
 - [Capturing audio](#capturing-audio)
-  - [From Pulseaudio monitor source (Easy, default if 
supported)](#from-pulseaudio-monitor-source-easy-default-if-supported)
-  - [From ALSA-loopback device (Tricky)](#from-alsa-loopback-device-tricky)
-  - [From mpd's fifo output](#from-mpds-fifo-output)
+  - [Pulseaudio monitor source (Easy, default if 
supported)](#pulseaudio-monitor-source-easy-default-if-supported)
+  - [ALSA-loopback device (Tricky)](#alsa-loopback-device-tricky)
+  - [mpd's fifo output](#mpds-fifo-output)
   - [sndio](#sndio)
   - [squeezelite](#squeezelite)
   - [macOS](#macos)
+  - [Windows - winscap - WSL](#Windows---winscap---WSL)
 - [Running via ssh](#running-via-ssh)
   - [Raw Output](#raw-output)
 - [Font notes](#font-notes)
@@ -92,13 +92,13 @@
 
 Debian Buster or higher/Ubuntu 18.04 or higher :
 
-    apt-get install libfftw3-dev libasound2-dev libncursesw5-dev libpulse-dev 
libtool automake libiniparser-dev
+    apt install libfftw3-dev libasound2-dev libncursesw5-dev libpulse-dev 
libtool automake libiniparser-dev
     export CPPFLAGS=-I/usr/include/iniparser
 
 
 older Debian/Ubuntu:
 
-    apt-get install libfftw3-dev libasound2-dev libncursesw5-dev libpulse-dev 
libtool automake
+    apt install libfftw3-dev libasound2-dev libncursesw5-dev libpulse-dev 
libtool automake
 
 
 ArchLinux:
@@ -135,6 +135,22 @@
 
 Tested on macOS High Sierra.
 
+For M1 Mac I was able to build all prerequisites from source. It might work 
with homebrew rosetta emulation, but what's the fun in that.
+
+* build and install automake, autoconf and libtool following the instructions 
[here](https://superuser.com/questions/383580/how-to-install-autoconf-automake-and-related-tools-on-mac-os-x-from-source).
+* build and install fftw from the gz archive 
[here](http://www.fftw.org/download.html)
+* download ncurses source and configure with these options:
+```
+./configure --prefix=/usr/local \
+  --without-cxx --without-cxx-binding --without-ada --without-progs 
--with-curses-h \
+  --with-shared --without-debug  \
+  --enable-widec --enable-const --enable-ext-colors --enable-sigwinch 
--enable-wgetch-events \
+```
+* just clone portaudio repo, build and install.
+* install [Backround Music](https://github.com/kyleneideck/BackgroundMusic) 
following option 1 in "Installing from Source Code". (requires xcode)
+* then build cava normally and follow the instructions in "capturing audio"
+
+
 
 
 #### Building
@@ -189,29 +205,28 @@
 
     pacaur -S cava
 
-#### Ubuntu
+#### Ubuntu/Debian
+
+##### Ubuntu 20.10 or more recent / Debian (unstable)
+
+    apt install cava
+    
+##### Older Ubuntu
 
 Harshal Sheth has added CAVA to his PPA, it can be installed with:
 
     add-apt-repository ppa:hsheth2/ppa
-    apt-get update
-    apt-get install cava
+    apt update
+    apt install cava
+    
 
 All distro specific instalation sources might be out of date.
 
-#### Debian (unstable)
-
-A package has now been introduced into Debian Unstable.
-
-    apt-get install cava
-    
-It should move into Debian testing and stable over time, and will therefore 
also move into the repositories of Ubuntu and its derivatives. For more 
information see issue [#373](https://github.com/karlstav/cava/issues/373).
-
 
 Capturing audio
 ---------------
 
-### From Pulseaudio monitor source (Easy, default if supported)
+### Pulseaudio monitor source (Easy, default if supported)
 
 Just make sure you have installed pulseaudio dev files and that cava has been 
built with pulseaudio support (it should be automatically if the dev files are 
found).
 
@@ -220,7 +235,7 @@
 If nothing happens you might have to use a different source than the default. 
The default might also be your microphone. Look at the [config](#configuration) 
file for help. 
 
 
-### From ALSA-loopback device (Tricky)
+### ALSA-loopback device (Tricky)
 
 Set
 
@@ -250,7 +265,7 @@
 dtoverlay=i2s-mmap
 ```
 
-### From mpd's fifo output
+### mpd's fifo output
 
 Add these lines in mpd:
 
@@ -300,7 +315,7 @@
 
 ### macOS
 
-Note: cava looks no good in the default macOS terminal. For a better look 
install [kitty](https://sw.kovidgoyal.net/kitty/index.html). Be where that you 
might run into #109, that can be fixed like 
[this](https://stackoverflow.com/questions/7165108/in-os-x-lion-lang-is-not-set-to-utf-8-how-to-fix-it).
+Note: Cava doesn't render correctly within the default macOS terminal. In 
order to achieve an optimal display, install 
[Kitty](https://sw.kovidgoyal.net/kitty/index.html). Beware that you may run in 
to the issue presented in #109; however, it can be resolved with 
[this](https://stackoverflow.com/questions/7165108/in-os-x-lion-lang-is-not-set-to-utf-8-how-to-fix-it).
 
 **Background Music**
 
@@ -322,6 +337,10 @@
 source = "Soundflower (2ch)"
 ```
 
+### Windows - winscap - WSL
+
+@quantum5 has written a handy tool called 
[winscap](https://github.com/quantum5/winscap) to capture audio from Windows 
and output it to stdout. Just follow the instructions in the readme on how to 
set it up with cava.
+
 
 Running via ssh
 ---------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/autogen.sh new/cava-0.7.4/autogen.sh
--- old/cava-0.7.3/autogen.sh   2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/autogen.sh   2021-05-18 20:13:38.000000000 +0200
@@ -3,7 +3,7 @@
 if [ -d .git ]; then
   git describe --always --tags --dirty > version # get version from git
 else
-  echo 0.7.3 > version # hard coded versions
+  echo 0.7.4 > version # hard coded versions
 fi
 
 libtoolize
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/cava.c new/cava-0.7.4/cava.c
--- old/cava-0.7.3/cava.c       2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/cava.c       2021-05-18 20:13:38.000000000 +0200
@@ -174,31 +174,22 @@
 // general: entry point
 int main(int argc, char **argv) {
 
-    // general: define variables
-    pthread_t p_thread;
-    int thr_id GCC_UNUSED;
-    float cut_off_frequency[256];
-    float upper_cut_off_frequency[256];
-    float relative_cut_off[256];
-    double center_frequencies[256];
-    int bars[256], FFTbuffer_lower_cut_off[256], FFTbuffer_upper_cut_off[256];
-    int *bars_left, *bars_right;
-    double *temp_l, *temp_r;
-    int bars_mem[256];
-    int bars_last[256];
-    int previous_frame[256];
-    int sleep_counter = 0;
-    int n, height, lines, width, c, rest, inAtty, fp, fptest, rc;
-    bool silence = false;
-    // int cont = 1;
-    int fall[256];
-    // float temp;
-    float bars_peak[256];
-    double eq[256];
-    float g;
-    struct timespec req = {.tv_sec = 0, .tv_nsec = 0};
-    struct timespec sleep_mode_timer = {.tv_sec = 1, .tv_nsec = 0};
+    // general: console title
+    printf("%c]0;%s%c", '\033', PACKAGE, '\007');
+
+    // general: handle command-line arguments
     char configPath[PATH_MAX];
+    configPath[0] = '\0';
+
+    // general: handle Ctrl+C
+    struct sigaction action;
+    memset(&action, 0, sizeof(action));
+    action.sa_handler = &sig_handler;
+    sigaction(SIGINT, &action, NULL);
+    sigaction(SIGTERM, &action, NULL);
+    sigaction(SIGUSR1, &action, NULL);
+    sigaction(SIGUSR2, &action, NULL);
+
     char *usage = "\n\
 Usage : " PACKAGE " [options]\n\
 Visualize audio input in terminal. \n\
@@ -220,32 +211,7 @@
 \n\
 as of 0.4.0 all options are specified in config file, see in 
'/home/username/.config/cava/' \n";
 
-    char ch = '\0';
-    int number_of_bars = 25;
-    double userEQ_keys_to_bars_ratio;
-
-    struct audio_data audio;
-    memset(&audio, 0, sizeof(audio));
-
-#ifndef NDEBUG
-    int maxvalue = 0;
-    int minvalue = 0;
-#endif
-    // general: console title
-    printf("%c]0;%s%c", '\033', PACKAGE, '\007');
-
-    configPath[0] = '\0';
-
-    // general: handle Ctrl+C
-    struct sigaction action;
-    memset(&action, 0, sizeof(action));
-    action.sa_handler = &sig_handler;
-    sigaction(SIGINT, &action, NULL);
-    sigaction(SIGTERM, &action, NULL);
-    sigaction(SIGUSR1, &action, NULL);
-    sigaction(SIGUSR2, &action, NULL);
-
-    // general: handle command-line arguments
+    int c;
     while ((c = getopt(argc, argv, "p:vh")) != -1) {
         switch (c) {
         case 'p': // argument: fifo path
@@ -263,8 +229,6 @@
         default: // argument: no arguments; exit
             abort();
         }
-
-        n = 0;
     }
 
     // general: main loop
@@ -279,7 +243,10 @@
             exit(EXIT_FAILURE);
         }
 
-        output_mode = p.om;
+        bool first = true;
+        int inAtty;
+
+        output_mode = p.output;
 
         if (output_mode != OUTPUT_RAW) {
             // Check if we're running in a tty
@@ -291,7 +258,16 @@
             if (strncmp(ttyname(0), "/dev/ttys", 9) == 0)
                 inAtty = 0;
             if (inAtty) {
-                system("setfont cava.psf  >/dev/null 2>&1");
+                // checking if cava psf font is installed in FONTDIR
+                FILE *font_file;
+                font_file = fopen(FONTDIR "/cava.psf", "r");
+                if (font_file) {
+                    fclose(font_file);
+                    system("setfont " FONTDIR "/cava.psf  >/dev/null 2>&1");
+                } else {
+                    // if not it might still be available, we dont know, must 
try
+                    system("setfont cava.psf  >/dev/null 2>&1");
+                }
                 system("setterm -blank 0");
             }
 
@@ -311,9 +287,15 @@
         }
 
         // input: init
+        int *bars_left, *bars_right;
+        double *temp_l, *temp_r;
+
         int bass_cut_off = 150;
         int treble_cut_off = 2500;
 
+        struct audio_data audio;
+        memset(&audio, 0, sizeof(audio));
+
         audio.source = malloc(1 + strlen(p.audio_source));
         strcpy(audio.source, p.audio_source);
 
@@ -418,7 +400,14 @@
         reset_output_buffers(&audio);
 
         debug("starting audio thread\n");
-        switch (p.im) {
+
+        pthread_t p_thread;
+        int timeout_counter = 0;
+
+        struct timespec timeout_timer = {.tv_sec = 0, .tv_nsec = 1000000};
+        int thr_id GCC_UNUSED;
+
+        switch (p.input) {
 #ifdef ALSA
         case INPUT_ALSA:
             // input_alsa: wait for the input to be ready
@@ -437,14 +426,12 @@
             thr_id = pthread_create(&p_thread, NULL, input_alsa,
                                     (void *)&audio); // starting alsamusic 
listener
 
-            n = 0;
+            timeout_counter = 0;
 
             while (audio.format == -1 || audio.rate == 0) {
-                req.tv_sec = 0;
-                req.tv_nsec = 1000000;
-                nanosleep(&req, NULL);
-                n++;
-                if (n > 2000) {
+                nanosleep(&timeout_timer, NULL);
+                timeout_counter++;
+                if (timeout_counter > 2000) {
                     cleanup();
                     fprintf(stderr, "could not get rate and/or format, 
problems with audio thread? "
                                     "quiting...\n");
@@ -479,14 +466,11 @@
         case INPUT_SHMEM:
             thr_id = pthread_create(&p_thread, NULL, input_shmem, (void 
*)&audio);
 
-            n = 0;
-
+            timeout_counter = 0;
             while (audio.rate == 0) {
-                req.tv_sec = 0;
-                req.tv_nsec = 1000000;
-                nanosleep(&req, NULL);
-                n++;
-                if (n > 2000) {
+                nanosleep(&timeout_timer, NULL);
+                timeout_counter++;
+                if (timeout_counter > 2000) {
                     cleanup();
                     fprintf(stderr, "could not get rate and/or format, 
problems with audio thread? "
                                     "quiting...\n");
@@ -512,10 +496,18 @@
             exit(EXIT_FAILURE);
         }
 
-        bool reloadConf = false;
+        int bars[256];
+        int bars_mem[256];
+        int bars_last[256];
+        int previous_frame[256];
+        int fall[256];
+        float bars_peak[256];
 
+        int height, lines, width, remainder, fp;
+
+        bool reloadConf = false;
         while (!reloadConf) { // jumping back to this loop means that you 
resized the screen
-            for (n = 0; n < 256; n++) {
+            for (int n = 0; n < 256; n++) {
                 bars_last[n] = 0;
                 previous_frame[n] = 0;
                 fall[n] = 0;
@@ -552,6 +544,7 @@
 
             case OUTPUT_RAW:
                 if (strcmp(p.raw_target, "/dev/stdout") != 0) {
+                    int fptest;
                     // checking if file exists
                     if (access(p.raw_target, F_OK) != -1) {
                         // testopening in case it's a fifo
@@ -571,7 +564,6 @@
                         fptest = open(p.raw_target, O_RDONLY | O_NONBLOCK, 
0644);
                     }
                 }
-
                 fp = open(p.raw_target, O_WRONLY | O_NONBLOCK | O_CREAT, 0644);
                 if (fp == -1) {
                     printf("could not open file %s for writing\n", 
p.raw_target);
@@ -600,13 +592,11 @@
                     p.autobars = 1;
             }
 
-            // getting original numbers of bars incase of resize
-            if (p.autobars == 1) {
+            // getting numbers of bars
+            int number_of_bars = p.fixedbars;
+
+            if (p.autobars == 1)
                 number_of_bars = (width + p.bar_spacing) / (p.bar_width + 
p.bar_spacing);
-                // if (p.bar_spacing != 0) number_of_bars = (width - 
number_of_bars * p.bar_spacing
-                // + p.bar_spacing) / bar_width;
-            } else
-                number_of_bars = p.fixedbars;
 
             if (number_of_bars < 1)
                 number_of_bars = 1; // must have at least 1 bars
@@ -619,14 +609,14 @@
             }
 
             // checks if there is stil extra room, will use this to center
-            rest = (width - number_of_bars * p.bar_width - number_of_bars * 
p.bar_spacing +
-                    p.bar_spacing) /
-                   2;
-            if (rest < 0)
-                rest = 0;
+            remainder = (width - number_of_bars * p.bar_width - number_of_bars 
* p.bar_spacing +
+                         p.bar_spacing) /
+                        2;
+            if (remainder < 0)
+                remainder = 0;
 
             // process [smoothing]: calculate gravity
-            g = p.gravity * ((float)height / 2160) * pow((60 / 
(float)p.framerate), 2.5);
+            float g = p.gravity * ((float)height / 2160) * pow((60 / 
(float)p.framerate), 2.5);
 
             // calculate integral value, must be reduced with height
             double integral = p.integral;
@@ -634,13 +624,17 @@
                 integral = p.integral * 1 / sqrt((log10((float)height / 10)));
 
 #ifndef NDEBUG
-            debug("height: %d width: %d bars:%d bar width: %d rest: %d\n", 
height, width,
-                  number_of_bars, p.bar_width, rest);
+            debug("height: %d width: %d bars:%d bar width: %d remainder: 
%d\n", height, width,
+                  number_of_bars, p.bar_width, remainder);
 #endif
 
+            // process: calculate cutoff frequencies and eq
             if (p.stereo)
                 number_of_bars =
                     number_of_bars / 2; // in stereo only half number of 
number_of_bars per channel
+                                        // for cutoff frequencies and eq 
calculation
+
+            double userEQ_keys_to_bars_ratio;
 
             if (p.userEQ_enabled && (number_of_bars > 0)) {
                 userEQ_keys_to_bars_ratio =
@@ -651,14 +645,21 @@
             double frequency_constant = log10((float)p.lower_cut_off / 
(float)p.upper_cut_off) /
                                         (1 / ((float)number_of_bars + 1) - 1);
 
-            // process: calculate cutoff frequencies and eq
+            float cut_off_frequency[256];
+            float upper_cut_off_frequency[256];
+            float relative_cut_off[256];
+            double center_frequencies[256];
+            int FFTbuffer_lower_cut_off[256];
+            int FFTbuffer_upper_cut_off[256];
+            double eq[256];
+
             int bass_cut_off_bar = -1;
             int treble_cut_off_bar = -1;
             bool first_bar = true;
             int first_treble_bar = 0;
             int bar_buffer[number_of_bars + 1];
 
-            for (n = 0; n < number_of_bars + 1; n++) {
+            for (int n = 0; n < number_of_bars + 1; n++) {
                 double bar_distribution_coefficient = frequency_constant * 
(-1);
                 bar_distribution_coefficient +=
                     ((float)n + 1) / ((float)number_of_bars + 1) * 
frequency_constant;
@@ -780,6 +781,7 @@
             if (p.stereo)
                 number_of_bars = number_of_bars * 2;
 
+            // process: calculate x axis values
             int x_axis_info = 0;
 
             if (p.xaxis != NONE) {
@@ -787,10 +789,10 @@
                 double center_frequency;
                 if (output_mode == OUTPUT_NONCURSES) {
                     printf("\r\033[%dB", lines + 1);
-                    if (rest)
-                        printf("\033[%dC", rest);
+                    if (remainder)
+                        printf("\033[%dC", remainder);
                 }
-                for (n = 0; n < number_of_bars; n++) {
+                for (int n = 0; n < number_of_bars; n++) {
                     if (p.stereo) {
                         if (n < number_of_bars / 2)
                             center_frequency = 
center_frequencies[number_of_bars / 2 - 1 - n];
@@ -806,13 +808,13 @@
                     if (output_mode == OUTPUT_NCURSES) {
 #ifdef NCURSES
                         if (center_frequency < 1000)
-                            mvprintw(lines, n * (p.bar_width + p.bar_spacing) 
+ rest, "%-4d",
+                            mvprintw(lines, n * (p.bar_width + p.bar_spacing) 
+ remainder, "%-4d",
                                      freq_floor);
                         else if (center_frequency > 1000 && center_frequency < 
10000)
-                            mvprintw(lines, n * (p.bar_width + p.bar_spacing) 
+ rest, "%.2f",
+                            mvprintw(lines, n * (p.bar_width + p.bar_spacing) 
+ remainder, "%.2f",
                                      freq_kilohz);
                         else
-                            mvprintw(lines, n * (p.bar_width + p.bar_spacing) 
+ rest, "%.1f",
+                            mvprintw(lines, n * (p.bar_width + p.bar_spacing) 
+ remainder, "%.1f",
                                      freq_kilohz);
 #endif
                     } else if (output_mode == OUTPUT_NONCURSES) {
@@ -831,15 +833,26 @@
             }
 
             bool resizeTerminal = false;
-            // fcntl(0, F_SETFL, O_NONBLOCK);
 
+            struct timespec framerate_timer = {.tv_sec = 0, .tv_nsec = 0};
             if (p.framerate <= 1) {
-                req.tv_sec = 1 / (float)p.framerate;
+                framerate_timer.tv_sec = 1 / (float)p.framerate;
             } else {
-                req.tv_sec = 0;
-                req.tv_nsec = (1 / (float)p.framerate) * 1e9;
+                framerate_timer.tv_sec = 0;
+                framerate_timer.tv_nsec = (1 / (float)p.framerate) * 1e9;
             }
 
+            int sleep_counter = 0;
+            bool silence = false;
+            char ch = '\0';
+
+#ifndef NDEBUG
+            int maxvalue = 0;
+            int minvalue = 0;
+#endif
+
+            struct timespec sleep_mode_timer = {.tv_sec = 1, .tv_nsec = 0};
+
             while (!resizeTerminal) {
 
 // general: keyboard controls
@@ -848,6 +861,7 @@
                     ch = getch();
 #endif
                 /*
+                // disabled key controls in non-curses mode, caused garbage on 
screen
                 if (output_mode == OUTPUT_NONCURSES)
                     ch = fgetc(stdin);
                 */
@@ -913,8 +927,6 @@
                     reload_colors = 0;
                 }
 
-                // if (cont == 0) break;
-
 #ifndef NDEBUG
                 // clear();
                 refresh();
@@ -923,7 +935,7 @@
                 // process: check if input is present
                 silence = true;
 
-                for (n = 0; n < audio.FFTbassbufferSize; n++) {
+                for (int n = 0; n < audio.FFTbassbufferSize; n++) {
                     if (audio.in_bass_l[n] || audio.in_bass_r[n]) {
                         silence = false;
                         break;
@@ -959,7 +971,7 @@
                 pthread_mutex_unlock(&lock);
 
                 // process: separate frequency bands
-                for (n = 0; n < number_of_bars; n++) {
+                for (int n = 0; n < number_of_bars; n++) {
 
                     temp_l[n] = 0;
                     if (p.stereo)
@@ -1029,7 +1041,7 @@
 
                 bool senselow = true;
 
-                for (n = 0; n < number_of_bars; n++) {
+                for (int n = 0; n < number_of_bars; n++) {
                     // mirroring stereo channels
                     if (p.stereo) {
                         if (n < number_of_bars / 2) {
@@ -1099,34 +1111,40 @@
                         if (bars[n] > height && senselow) {
                             p.sens = p.sens * 0.98;
                             senselow = false;
+                            first = false;
                         }
                     }
                 }
 
-                if (p.autosens && !silence && senselow)
+                if (p.autosens && !silence && senselow) {
                     p.sens = p.sens * 1.001;
+                    if (first)
+                        p.sens = p.sens * 1.1;
+                }
 
 #ifndef NDEBUG
-                mvprintw(n + 1, 0, "sensitivity %.10e", p.sens);
-                mvprintw(n + 2, 0, "min value: %d\n", minvalue); // checking 
maxvalue 10000
-                mvprintw(n + 3, 0, "max value: %d\n", maxvalue); // checking 
maxvalue 10000
-                (void)rc;
+                mvprintw(number_of_bars + 1, 0, "sensitivity %.10e", p.sens);
+                mvprintw(number_of_bars + 2, 0, "min value: %d\n",
+                         minvalue); // checking maxvalue 10000
+                mvprintw(number_of_bars + 3, 0, "max value: %d\n",
+                         maxvalue); // checking maxvalue 10000
                 (void)x_axis_info;
 #endif
 
 // output: draw processed input
 #ifdef NDEBUG
+                int rc;
                 switch (output_mode) {
                 case OUTPUT_NCURSES:
 #ifdef NCURSES
                     rc = draw_terminal_ncurses(inAtty, lines, width, 
number_of_bars, p.bar_width,
-                                               p.bar_spacing, rest, bars, 
previous_frame,
+                                               p.bar_spacing, remainder, bars, 
previous_frame,
                                                p.gradient, x_axis_info);
                     break;
 #endif
                 case OUTPUT_NONCURSES:
                     rc = draw_terminal_noncurses(inAtty, lines, width, 
number_of_bars, p.bar_width,
-                                                 p.bar_spacing, rest, bars, 
previous_frame,
+                                                 p.bar_spacing, remainder, 
bars, previous_frame,
                                                  x_axis_info);
                     break;
                 case OUTPUT_RAW:
@@ -1153,13 +1171,10 @@
                     exit(EXIT_FAILURE);
                 }
 
-                nanosleep(&req, NULL);
+                nanosleep(&framerate_timer, NULL);
             } // resize terminal
 
         } // reloading config
-        req.tv_sec = 0;
-        req.tv_nsec = 100; // waiting some time to make sure audio is ready
-        nanosleep(&req, NULL);
 
         //**telling audio thread to terminate**//
         audio.terminate = 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/config.c new/cava-0.7.4/config.c
--- old/cava-0.7.3/config.c     2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/config.c     2021-05-18 20:13:38.000000000 +0200
@@ -59,11 +59,11 @@
     if (checkColor[0] == '#' && strlen(checkColor) == 7) {
         // If the output mode is not ncurses, tell the user to use a named 
colour instead of hex
         // colours.
-        if (p->om != OUTPUT_NCURSES) {
+        if (p->output != OUTPUT_NCURSES) {
 #ifdef NCURSES
             write_errorf(error,
                          "hex color configured, but ncurses not set. Forcing 
ncurses mode.\n");
-            p->om = OUTPUT_NCURSES;
+            p->output = OUTPUT_NCURSES;
 #else
             write_errorf(error,
                          "Only 'ncurses' output method supports HTML colors "
@@ -171,9 +171,9 @@
 
 bool validate_config(struct config_params *p, struct error_s *error) {
     // validate: output method
-    p->om = OUTPUT_NOT_SUPORTED;
+    p->output = OUTPUT_NOT_SUPORTED;
     if (strcmp(outputMethod, "ncurses") == 0) {
-        p->om = OUTPUT_NCURSES;
+        p->output = OUTPUT_NCURSES;
         p->bgcol = -1;
 #ifndef NCURSES
         write_errorf(error, "cava was built without ncurses support, install 
ncursesw dev files "
@@ -182,11 +182,11 @@
 #endif
     }
     if (strcmp(outputMethod, "noncurses") == 0) {
-        p->om = OUTPUT_NONCURSES;
+        p->output = OUTPUT_NONCURSES;
         p->bgcol = 0;
     }
     if (strcmp(outputMethod, "raw") == 0) { // raw:
-        p->om = OUTPUT_RAW;
+        p->output = OUTPUT_RAW;
         p->bar_spacing = 0;
         p->bar_width = 1;
 
@@ -216,7 +216,7 @@
             return false;
         }
     }
-    if (p->om == OUTPUT_NOT_SUPORTED) {
+    if (p->output == OUTPUT_NOT_SUPORTED) {
 #ifndef NCURSES
         write_errorf(
             error,
@@ -392,17 +392,24 @@
         // config: adding default filename file
         strcat(configPath, configFile);
 
+        // open file or create file if it does not exist
         fp = fopen(configPath, "ab+");
         if (fp) {
             fclose(fp);
         } else {
-            write_errorf(error, "Unable to access config '%s', exiting...\n", 
configPath);
-            return false;
+            // try to open file read only
+            fp = fopen(configPath, "rb");
+            if (fp) {
+                fclose(fp);
+            } else {
+                write_errorf(error, "Unable to open or create file '%s', 
exiting...\n", configPath);
+                return false;
+            }
         }
 
     } else { // opening specified file
 
-        fp = fopen(configPath, "rb+");
+        fp = fopen(configPath, "rb");
         if (fp) {
             fclose(fp);
         } else {
@@ -496,8 +503,8 @@
         }
     }
 
-    p->im = input_method_by_name(input_method_name);
-    switch (p->im) {
+    p->input = input_method_by_name(input_method_name);
+    switch (p->input) {
 #ifdef ALSA
     case INPUT_ALSA:
         p->audio_source = strdup(iniparser_getstring(ini, "input:source", 
"hw:Loopback,1"));
@@ -542,7 +549,7 @@
     }
     default:
         write_errorf(error, "cava was built without '%s' input support\n",
-                     input_method_names[p->im]);
+                     input_method_names[p->input]);
         return false;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/config.h new/cava-0.7.4/config.h
--- old/cava-0.7.3/config.h     2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/config.h     2021-05-18 20:13:38.000000000 +0200
@@ -54,8 +54,8 @@
     double monstercat, integral, gravity, ignore, sens;
     unsigned int lower_cut_off, upper_cut_off;
     double *userEQ;
-    enum input_method im;
-    enum output_method om;
+    enum input_method input;
+    enum output_method output;
     enum xaxis_scale xaxis;
     int userEQ_keys, userEQ_enabled, col, bgcol, autobars, stereo, is_bin, 
ascii_range, bit_format,
         gradient, gradient_count, fixedbars, framerate, bar_width, 
bar_spacing, autosens, overshoot,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/configure.ac new/cava-0.7.4/configure.ac
--- old/cava-0.7.3/configure.ac 2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/configure.ac 2021-05-18 20:13:38.000000000 +0200
@@ -270,7 +270,7 @@
 dnl ############################
 dnl Set font directory
 dnl ############################
-DEFAULT_FONT_DIR="/usr/share/consolefonts"
+DEFAULT_FONT_DIR="${datarootdir}/consolefonts"
 AC_ARG_VAR(FONT_DIR, [Directory where the font will be installed.])
 if test -z "$FONT_DIR" ; then
   FONT_DIR="$DEFAULT_FONT_DIR"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/example_files/config 
new/cava-0.7.4/example_files/config
--- old/cava-0.7.3/example_files/config 2020-10-07 18:30:24.000000000 +0200
+++ new/cava-0.7.4/example_files/config 2021-05-18 20:13:38.000000000 +0200
@@ -15,7 +15,7 @@
 ; autosens = 1
 ; overshoot = 20
 
-# Manual sensitivity in %. Autosens must be turned off for this to take effect.
+# Manual sensitivity in %. If autosens is enabled, this will only be the 
initial value.
 # 200 means double height. Accepts only non-negative values.
 ; sensitivity = 100
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cava-0.7.3/output/terminal_ncurses.c 
new/cava-0.7.4/output/terminal_ncurses.c
--- old/cava-0.7.3/output/terminal_ncurses.c    2020-10-07 18:30:24.000000000 
+0200
+++ new/cava-0.7.4/output/terminal_ncurses.c    2021-05-18 20:13:38.000000000 
+0200
@@ -193,7 +193,7 @@
 
 int draw_terminal_ncurses(int is_tty, int terminal_height, int terminal_width, 
int bars_count,
                           int bar_width, int bar_spacing, int rest, const int 
bars[256],
-                          int previous_frame[200], int gradient, int 
x_axis_info) {
+                          int previous_frame[256], int gradient, int 
x_axis_info) {
     const int height = terminal_height - 1;
 
     // output: check if terminal has been resized

Reply via email to