diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 10869f6a..4e14fa26 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,29 +7,42 @@ assignees: '' --- -**When/where was the bug introduced?** -- Are you using cava from a package repository, like AUR? -- If so, check out the master branch here, is your issue already resolved? -- Don't know how to clone, compile source code? File report to package maintainer instead. -- try using git bisect to find out where the bug was introduced. +**READ THIS BEFORE CREATING NEW ISSUE** + +Are you using cava from a package repository, like AUR? + +If so, clone the master branch from here, build and run. Is your issue already resolved? + +Don't know how to clone or compile source code? File report to package maintainer instead! + + **Describe the bug** + A clear and concise description of what the bug is. + **To Reproduce** + Steps to reproduce the behavior: 1. Set config parameter to 2. run 3. do something 4. See error + **Expected behavior** + A clear and concise description of what you expected to happen. + **Screenshots** + If applicable, add screenshots to help explain your problem. + **Desktop (please complete the following information):** + - OS: [e.g. macOS, Ubuntu] - Version [e.g. 22] diff --git a/README.md b/README.md index 4bde45ea..2cb9486c 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ Required components: * libtool * automake * autoconf-archive (needed for setting up OpenGL) +* pkgconf * build-essentials * [iniparser](https://github.com/ndevilla/iniparser) @@ -89,22 +90,22 @@ All the requirements can be installed easily in all major distros: Debian/Ubuntu: - sudo apt install build-essential libfftw3-dev libasound2-dev libncursesw5-dev libpulse-dev libtool automake autoconf-archive libiniparser-dev libsdl2-2.0-0 libsdl2-dev libpipewire-0.3-dev + sudo apt install build-essential libfftw3-dev libasound2-dev libncursesw5-dev libpulse-dev libtool automake autoconf-archive libiniparser-dev libsdl2-2.0-0 libsdl2-dev libpipewire-0.3-dev pkgconf ArchLinux: - pacman -S base-devel fftw ncurses alsa-lib iniparser pulseaudio autoconf-archive + pacman -S base-devel fftw ncurses alsa-lib iniparser pulseaudio autoconf-archive pkgconf openSUSE: - zypper install alsa-devel ncurses-devel fftw3-devel libpulse-devel libtool autoconf-archive + zypper install alsa-devel ncurses-devel fftw3-devel libpulse-devel libtool autoconf-archive pkgconf Fedora: - dnf install alsa-lib-devel ncurses-devel fftw3-devel pulseaudio-libs-devel libtool autoconf-archive iniparser-devel + dnf install alsa-lib-devel ncurses-devel fftw3-devel pulseaudio-libs-devel libtool autoconf-archive iniparser-devel pkgconf macOS: @@ -406,6 +407,9 @@ So in `cava.psf`, the characters 1-7 are actually replaced by Unicode characters Actually, `setfont` is supposed to return the default font, but this usually isn't set. I haven't found another way to get the current font. So cava sets the font to "Lat2-Fixed16" when interrupted. All major distros should have it. It will revert to your default font at reboot. +### Gradient not working in Konsole + +Konsole simply does not support this. #194 Usage ----- diff --git a/autogen.sh b/autogen.sh index bb14b92d..161b26d1 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.8.3 > version # hard coded versions + echo 0.9.1 > version # hard coded versions fi libtoolize diff --git a/cava_win/README.md b/cava_win/README.md index 677ebc0e..94b3e593 100644 --- a/cava_win/README.md +++ b/cava_win/README.md @@ -1,11 +1,11 @@ # cava on windows -All dependencies should install themselves via the nuget thing: +All dependencies should install themselves via the NuGet thing: * SDL2 * FFTW * pthreads * glew -include paths are configure relativly to the project so linking and inlcuding should work autmatically with the nugets, but might stop workiong at some point. +include paths are configured relatively to the project so linking and including should work automatically with the nugets, but might stop working at some point. The Visual C++ Redistributable for Visual Studio 2012 (maybe also a newer one) was needed when I first ran it. diff --git a/cavacore_test.c b/cavacore_test.c index cb36e3c9..6a746e7e 100644 --- a/cavacore_test.c +++ b/cavacore_test.c @@ -20,8 +20,8 @@ void main() { double noise_reduction = 0.77; int low_cut_off = 50; int high_cut_off = 10000; - double blueprint_2000MHz[10] = {0, 0, 0, 0, 0, 0, 0.494, 0.449, 0, 0}; - double blueprint_200MHz[10] = {0, 0, 0.939, 0.008, 0, 0.001, 0, 0, 0, 0}; + double blueprint_2000MHz[10] = {0, 0, 0, 0, 0, 0, 0.493, 0.446, 0, 0}; + double blueprint_200MHz[10] = {0, 0, 0.978, 0.008, 0, 0.001, 0, 0, 0, 0}; printf("planning visualization with %d bars per channel, %d rate, %d channels, autosens, " "%.2f noise reduction, %d - %d MHz bandwith.\n", diff --git a/configure.ac b/configure.ac index e9532979..5a757549 100644 --- a/configure.ac +++ b/configure.ac @@ -105,10 +105,10 @@ AC_ARG_ENABLE([input_pipewire], ) AS_IF([test "x$enable_input_pipewire" != "xno"], [ - AC_CHECK_LIB(pipewire-0.3, pw_stream_connect, have_pipewire=yes, have_pipewire=no) + PKG_CHECK_MODULES(PIPEWIRE, libpipewire-0.3, have_pipewire=yes, have_pipewire=no) if [[ $have_pipewire = "yes" ]] ; then - LIBS="$LIBS -lpipewire-0.3" - CPPFLAGS="$CPPFLAGS -DPIPEWIRE -D_REENTRANT -I/usr/include/pipewire-0.3 -I/usr/include/spa-0.2" + LIBS="$LIBS $PIPEWIRE_LIBS" + CPPFLAGS="$CPPFLAGS -DPIPEWIRE $PIPEWIRE_CFLAGS" fi if [[ $have_pipewire = "no" ]] ; then diff --git a/example_files/config b/example_files/config index 89b7710e..45c5e149 100644 --- a/example_files/config +++ b/example_files/config @@ -54,6 +54,7 @@ # Audio capturing method. Possible methods are: 'pulse', 'alsa', 'fifo', 'sndio' or 'shmem' # Defaults to 'pulse', 'pipewire', 'alsa' or 'fifo', in that order, dependent on what support cava was built with. +# On Mac it defaults to 'portaudio' or 'fifo' # On windows this is automatic and no input settings are needed. # # All input methods uses the same config variable 'source' @@ -62,7 +63,7 @@ # For pulseaudio and pipewire 'source' will be the source. Default: 'auto', which uses the monitor source of the default sink # (all pulseaudio sinks(outputs) have 'monitor' sources(inputs) associated with them). # -# For piepwire 'source' will be the object name or object.serial of the device to capture from. +# For pipewire 'source' will be the object name or object.serial of the device to capture from. # Both input and output devices are supported. # # For alsa 'source' will be the capture device. diff --git a/meson.build b/meson.build index ec5c9291..5f377da0 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'cava', 'c', - version: '0.8.5', + version: '0.9.1', license: 'MIT', meson_version: '>=0.50.0', default_options : [ diff --git a/src/cavacore.c b/src/cavacore.c index 00be4917..bc55a139 100644 --- a/src/cavacore.c +++ b/src/cavacore.c @@ -494,12 +494,6 @@ void cava_execute(double *cava_in, int new_samples, double *cava_out, struct cav cava_out[n] = p->cava_mem[n] * p->noise_reduction + cava_out[n]; p->cava_mem[n] = cava_out[n]; if (p->autosens) { - double diff = 1 - cava_out[n]; - if (diff < 0) - diff = 0; - double div = 1 / (diff + 1); - p->cava_mem[n] = p->cava_mem[n] * (1 - div / 20); - // check if we overshoot target height if (cava_out[n] > 1.0) { overshoot = 1; diff --git a/src/config.c b/src/config.c index b49b16b7..fbd66d67 100644 --- a/src/config.c +++ b/src/config.c @@ -49,7 +49,7 @@ const char *default_shader_name[NUMBER_OF_SHADERS] = {"northern_lights.frag", "p double smoothDef[5] = {1, 1, 1, 1, 1}; enum input_method default_methods[] = { - INPUT_FIFO, INPUT_PORTAUDIO, INPUT_ALSA, INPUT_PULSE, INPUT_WINSCAP, + INPUT_FIFO, INPUT_PORTAUDIO, INPUT_ALSA, INPUT_PIPEWIRE, INPUT_PULSE, INPUT_WINSCAP, }; char *outputMethod, *orientation, *channels, *xaxisScale, *monoOption, *fragmentShader, @@ -224,7 +224,7 @@ bool validate_config(struct config_params *p, struct error_s *error) { if (strcmp(outputMethod, "sdl_glsl") == 0) { p->output = OUTPUT_SDL_GLSL; #ifndef SDL_GLSL - write_errorf(error, "cava was built without sdl support, install sdl dev files " + write_errorf(error, "cava was built without opengl support, install opengl dev files " "and run make clean && ./configure && make again\n"); return false; #endif @@ -388,6 +388,10 @@ bool validate_config(struct config_params *p, struct error_s *error) { } // setting sens + if (p->sens < 1) { + write_errorf(error, "Sensitivity needs to be at least 1%%\n"); + return false; + } p->sens = p->sens / 100; return validate_colors(p, error); @@ -678,11 +682,11 @@ bool load_config(char configPath[PATH_MAX], struct config_params *p, bool colors free(p->audio_source); - int default_input = -1; + enum input_method default_input = INPUT_FIFO; for (size_t i = 0; i < ARRAY_SIZE(default_methods); i++) { enum input_method method = default_methods[i]; if (has_input_method[method]) { - default_input++; + default_input = default_methods[i]; } } char *input_method_name = diff --git a/src/input/pipewire.c b/src/input/pipewire.c index 705aecc7..544d8cfd 100644 --- a/src/input/pipewire.c +++ b/src/input/pipewire.c @@ -1,7 +1,9 @@ #include "cava/input/pipewire.h" #include "cava/input/common.h" +#include #include +#include #include @@ -73,6 +75,8 @@ void *input_pipewire(void *audiodata) { struct pw_properties *props; struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer)); char **argv; + uint32_t nom; + nom = nearbyint((10000 * data.cava_audio->rate) / 1000000.0); pw_init(0, &argv); @@ -83,13 +87,14 @@ void *input_pipewire(void *audiodata) { pw_properties_set(props, PW_KEY_TARGET_OBJECT, data.cava_audio->source); pw_properties_set(props, PW_KEY_STREAM_CAPTURE_SINK, "true"); + pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%u", nom, data.cava_audio->rate); data.stream = pw_stream_new_simple(pw_main_loop_get_loop(data.loop), "cava", props, &stream_events, &data); params[0] = spa_format_audio_raw_build( &b, SPA_PARAM_EnumFormat, - &SPA_AUDIO_INFO_RAW_INIT(.format = SPA_AUDIO_FORMAT_S16, .rate = 44100)); + &SPA_AUDIO_INFO_RAW_INIT(.format = SPA_AUDIO_FORMAT_S16, .rate = data.cava_audio->rate)); pw_stream_connect(data.stream, PW_DIRECTION_INPUT, PW_ID_ANY, PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | diff --git a/src/output/sdl_cava.c b/src/output/sdl_cava.c index 1cf73922..e6b7cdee 100644 --- a/src/output/sdl_cava.c +++ b/src/output/sdl_cava.c @@ -178,15 +178,16 @@ int draw_sdl(int bars_count, int bar_width, int bar_spacing, int remainder, int SDL_Delay(frame_time); - SDL_PollEvent(&e); - if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { - rc = -1; - if (gradient) { - free(gradient_colors_sdl); + while (SDL_PollEvent(&e)) { + if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { + rc = -1; + if (gradient) { + free(gradient_colors_sdl); + } } + if (e.type == SDL_QUIT) + rc = -2; } - if (e.type == SDL_QUIT) - rc = -2; return rc; }