summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Flygenring-Harrsen <Lasse@Flygenring-Harrsen.com>2020-07-09 00:44:08 +0200
committerLasse Flygenring-Harrsen <Lasse@Flygenring-Harrsen.com>2020-07-09 00:44:08 +0200
commit1a99cbef669c7658566db753ab3f14478231048b (patch)
tree7c8c7d4434d477552a91f73779e1e1376427f4b8
parent6d2fa862858dafdea29fc2e4a3dc39c3dbb17f2e (diff)
New upstream version 0.7.2
-rw-r--r--Makefile.am4
-rwxr-xr-xautogen.sh2
-rw-r--r--cava.c26
-rw-r--r--output/terminal_noncurses.c9
4 files changed, 24 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am
index 0e109e3..8ee1c22 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,8 @@ if OSX
cava_CFLAGS += -DNORT
else
cava_LDFLAGS += -lrt
+ cava_font_dir = @FONT_DIR@
+ cava_font__DATA = cava.psf
endif
if ALSA
@@ -42,8 +44,6 @@ if NCURSES
cava_SOURCES += output/terminal_ncurses.c
endif
-cava_font_dir = @FONT_DIR@
-cava_font__DATA = cava.psf
if !SYSTEM_LIBINIPARSER
cava_LDADD = -liniparser
diff --git a/autogen.sh b/autogen.sh
index 0638e7c..bc3db5c 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -3,7 +3,7 @@
if [ -d .git ]; then
git describe --always --tags --dirty > version # get version from git
else
- echo 0.7.1 > version # hard coded versions
+ echo 0.7.2 > version # hard coded versions
fi
libtoolize
diff --git a/cava.c b/cava.c
index 45ec0c3..62859bf 100644
--- a/cava.c
+++ b/cava.c
@@ -243,6 +243,7 @@ int main(int argc, char **argv) {
double eq[256];
float g;
struct timespec req = {.tv_sec = 0, .tv_nsec = 0};
+ struct timespec sleep_mode_timer = {.tv_sec = 0, .tv_nsec = 0};
char configPath[PATH_MAX];
char *usage = "\n\
Usage : " PACKAGE " [options]\n\
@@ -746,6 +747,14 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
number_of_bars = number_of_bars * 2;
bool resizeTerminal = false;
+ fcntl(0, F_SETFL, O_NONBLOCK);
+
+ if (p.framerate <= 1) {
+ req.tv_sec = 1 / (float)p.framerate;
+ } else {
+ req.tv_sec = 0;
+ req.tv_nsec = (1 / (float)p.framerate) * 1e9;
+ }
while (!resizeTerminal) {
@@ -754,6 +763,8 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
if (output_mode == OUTPUT_NCURSES)
ch = getch();
#endif
+ if (output_mode == OUTPUT_NONCURSES)
+ ch = fgetc(stdin);
switch (ch) {
case 65: // key up
@@ -880,9 +891,9 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
printw("no sound detected for 5 sec, going to sleep mode\n");
#endif
// wait 0.1 sec, then check sound again.
- req.tv_sec = 0;
- req.tv_nsec = 100000000;
- nanosleep(&req, NULL);
+ sleep_mode_timer.tv_sec = 0;
+ sleep_mode_timer.tv_nsec = 100000000;
+ nanosleep(&sleep_mode_timer, NULL);
continue;
}
@@ -1015,14 +1026,6 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
resizeTerminal = true;
#endif
- if (p.framerate <= 1) {
- req.tv_sec = 1 / (float)p.framerate;
- } else {
- req.tv_sec = 0;
- req.tv_nsec = (1 / (float)p.framerate) * 1000000000;
- }
-
- nanosleep(&req, NULL);
memcpy(previous_frame, bars, 256 * sizeof(int));
@@ -1033,6 +1036,7 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
exit(EXIT_FAILURE);
}
+ nanosleep(&req, NULL);
} // resize terminal
} // reloading config
diff --git a/output/terminal_noncurses.c b/output/terminal_noncurses.c
index 6789f30..8f3fb90 100644
--- a/output/terminal_noncurses.c
+++ b/output/terminal_noncurses.c
@@ -25,9 +25,9 @@ int setecho(int fd, int onoff) {
return -1;
if (onoff == 0)
- t.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
+ t.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL | ICANON);
else
- t.c_lflag |= (ECHO | ECHOE | ECHOK | ECHONL);
+ t.c_lflag |= (ECHO | ECHOE | ECHOK | ECHONL | ICANON);
if (tcsetattr(fd, TCSANOW, &t) == -1)
return -1;
@@ -115,7 +115,10 @@ int init_terminal_noncurses(int tty, int col, int bgcol, int width, int lines, i
printf(" "); // setting backround color
}
- printf("\n");
+ if (n != 0)
+ printf("\n");
+ else
+ printf("\r");
}
printf("\033[%dA", lines); // moving cursor back up
}