mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-26 05:02:18 +00:00
audio/cava: Update to 0.6.1
- Drop upstreamed sndio patch - Enable SNDIO by default - Add explicit EXAMPLES option - Also install the README.md so that we install some form of documentation - ALSA is not applicable to cava on FreeBSD so don't mention it in the comment and description Changes: https://github.com/karlstav/cava/releases/tag/0.6.1
This commit is contained in:
parent
354a677604
commit
69a74cbf55
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=469360
@ -1,11 +1,11 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= cava
|
||||
DISTVERSION= 0.6.0
|
||||
DISTVERSION= 0.6.1
|
||||
CATEGORIES= audio
|
||||
|
||||
MAINTAINER= tobik@FreeBSD.org
|
||||
COMMENT= Console-based Audio Visualizer for ALSA, MPD, PulseAudio, and sndio
|
||||
COMMENT= Console-based Audio Visualizer for MPD, PulseAudio, and sndio
|
||||
|
||||
LICENSE= MIT
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
@ -22,8 +22,12 @@ CONFIGURE_ENV= ac_cv_lib_asound_snd_pcm_open=no
|
||||
|
||||
INSTALL_TARGET= install-strip
|
||||
|
||||
OPTIONS_DEFINE= PULSEAUDIO SNDIO
|
||||
OPTIONS_DEFAULT=PULSEAUDIO
|
||||
PLIST_FILES= bin/cava
|
||||
PORTDOCS= README.md
|
||||
PORTEXAMPLES= config
|
||||
|
||||
OPTIONS_DEFINE= DOCS EXAMPLES PULSEAUDIO SNDIO
|
||||
OPTIONS_DEFAULT=PULSEAUDIO SNDIO
|
||||
|
||||
PULSEAUDIO_CONFIGURE_ENV_OFF= ac_cv_lib_pulse_simple_pa_simple_new=no
|
||||
PULSEAUDIO_LIB_DEPENDS= libpulse-simple.so:audio/pulseaudio \
|
||||
@ -34,12 +38,15 @@ SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} '/^cava_font/d' ${WRKSRC}/Makefile.am
|
||||
@${REINPLACE_CMD} '/<alloca.h>/d' ${WRKSRC}/cava.c
|
||||
|
||||
pre-configure:
|
||||
@${ECHO_CMD} ${DISTVERSION} > ${WRKSRC}/version
|
||||
|
||||
post-install:
|
||||
post-install-DOCS-on:
|
||||
@${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
|
||||
|
||||
post-install-EXAMPLES-on:
|
||||
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/example_files/config ${STAGEDIR}${EXAMPLESDIR}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
TIMESTAMP = 1509139935
|
||||
SHA256 (karlstav-cava-0.6.0_GH0.tar.gz) = 42d51c6c283cd2b0f5125954ea8c61a12385703d1953ef9c40103402c7a744dc
|
||||
SIZE (karlstav-cava-0.6.0_GH0.tar.gz) = 40990
|
||||
TIMESTAMP = 1525757005
|
||||
SHA256 (karlstav-cava-0.6.1_GH0.tar.gz) = 98b880e7e704ed457863f379f31b488e06076bb34a5de02825096969b916a78d
|
||||
SIZE (karlstav-cava-0.6.1_GH0.tar.gz) = 42285
|
||||
|
@ -1,176 +0,0 @@
|
||||
https://github.com/karlstav/cava/commit/76fa7c132da25f5499a0f1b5dc4b416a34dad737
|
||||
|
||||
diff --git a/cava.c b/cava.c
|
||||
index 76197cd..64dff25 100644
|
||||
--- cava.c
|
||||
+++ cava.c
|
||||
@@ -53,6 +53,10 @@
|
||||
#include "input/pulse.c"
|
||||
#endif
|
||||
|
||||
+#ifdef SNDIO
|
||||
+#include "input/sndio.c"
|
||||
+#endif
|
||||
+
|
||||
#include <iniparser.h>
|
||||
|
||||
#include "config.h"
|
||||
@@ -287,6 +291,9 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
|
||||
#ifdef PULSE
|
||||
strcat(supportedInput,", 'pulse'");
|
||||
#endif
|
||||
+ #ifdef SNDIO
|
||||
+ strcat(supportedInput,", 'sndio'");
|
||||
+ #endif
|
||||
|
||||
//fft: planning to rock
|
||||
fftw_complex outl[M / 2 + 1][2];
|
||||
@@ -388,6 +395,13 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
|
||||
}
|
||||
#endif
|
||||
|
||||
+ #ifdef SNDIO
|
||||
+ if (p.im == 4) {
|
||||
+ thr_id = pthread_create(&p_thread, NULL, input_sndio, (void*)&audio);
|
||||
+ audio.rate = 44100;
|
||||
+ }
|
||||
+ #endif
|
||||
+
|
||||
if (p.highcf > audio.rate / 2) {
|
||||
cleanup();
|
||||
fprintf(stderr,
|
||||
diff --git a/config.c b/config.c
|
||||
index 1da11cd..9f8465e 100644
|
||||
--- config.c
|
||||
+++ config.c
|
||||
@@ -87,6 +87,13 @@ if (strcmp(inputMethod, "pulse") == 0) {
|
||||
#endif
|
||||
|
||||
}
|
||||
+if (strcmp(inputMethod, "sndio") == 0) {
|
||||
+ p->im = 4;
|
||||
+ #ifndef SNDIO
|
||||
+ fprintf(stderr, "cava was built without sndio support\n");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ #endif
|
||||
+}
|
||||
if (p->im == 0) {
|
||||
fprintf(stderr,
|
||||
"input method '%s' is not supported, supported methods are: %s\n",
|
||||
@@ -325,6 +332,10 @@ inputMethod = (char *)iniparser_getstring(ini, "input:method", "fifo");
|
||||
inputMethod = (char *)iniparser_getstring(ini, "input:method", "pulse");
|
||||
#endif
|
||||
|
||||
+//setting sndio to defaualt if supported
|
||||
+#ifdef SNDIO
|
||||
+ inputMethod = (char *)iniparser_getstring(ini, "input:method", "sndio");
|
||||
+#endif
|
||||
|
||||
#ifdef NCURSES
|
||||
outputMethod = (char *)iniparser_getstring(ini, "output:method", "ncurses");
|
||||
@@ -402,6 +413,12 @@ if (strcmp(inputMethod, "pulse") == 0) {
|
||||
p->im = 3;
|
||||
p->audio_source = (char *)iniparser_getstring(ini, "input:source", "auto");
|
||||
}
|
||||
+#ifdef SNDIO
|
||||
+if (strcmp(inputMethod, "sndio") == 0) {
|
||||
+ p->im = 4;
|
||||
+ p->audio_source = (char *)iniparser_getstring(ini, "input:source", SIO_DEVANY);
|
||||
+}
|
||||
+#endif
|
||||
|
||||
validate_config(supportedInput, params);
|
||||
//iniparser_freedict(ini);
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 6e3c291..92fa281 100644
|
||||
--- configure.ac
|
||||
+++ configure.ac
|
||||
@@ -64,6 +64,19 @@ AC_CHECK_LIB(pulse-simple, pa_simple_new, have_pulse=yes, have_pulse=no)
|
||||
AC_MSG_NOTICE([WARNING: No pusleaudio dev files found building without pulseaudio support])
|
||||
fi
|
||||
|
||||
+dnl ######################
|
||||
+dnl checking for sndio dev
|
||||
+dnl ######################
|
||||
+AC_CHECK_LIB(sndio, sio_open, have_sndio=yes, have_sndio=no)
|
||||
+ if [[ $have_sndio = "yes" ]] ; then
|
||||
+ LIBS="$LIBS -lsndio"
|
||||
+ CPPFLAGS="$CPPFLAGS -DSNDIO"
|
||||
+ fi
|
||||
+
|
||||
+ if [[ $have_sndio = "no" ]] ; then
|
||||
+ AC_MSG_NOTICE([WARNING: No sndio dev files found building without sndio support])
|
||||
+ fi
|
||||
+
|
||||
dnl ######################
|
||||
dnl checking for math lib
|
||||
dnl ######################
|
||||
diff --git a/input/sndio.c b/input/sndio.c
|
||||
new file mode 100644
|
||||
index 0000000..6142225
|
||||
--- /dev/null
|
||||
+++ input/sndio.c
|
||||
@@ -0,0 +1,63 @@
|
||||
+#include <assert.h>
|
||||
+#include <errno.h>
|
||||
+#include <sndio.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+void* input_sndio(void* data)
|
||||
+{
|
||||
+ struct audio_data *audio = (struct audio_data *)data;
|
||||
+ struct sio_par par;
|
||||
+ struct sio_hdl *hdl;
|
||||
+ int16_t buf[256];
|
||||
+ unsigned int i, n, channels;
|
||||
+
|
||||
+ assert(audio->channels > 0);
|
||||
+ channels = audio->channels;
|
||||
+
|
||||
+ sio_initpar(&par);
|
||||
+ par.sig = 1;
|
||||
+ par.bits = 16;
|
||||
+ par.le = 1;
|
||||
+ par.rate = 44100;
|
||||
+ par.rchan = channels;
|
||||
+ par.appbufsz = sizeof(buf) / channels;
|
||||
+
|
||||
+ if ((hdl = sio_open(audio->source, SIO_REC, 0)) == NULL) {
|
||||
+ fprintf(stderr, __FILE__": Could not open sndio source: %s\n", audio->source);
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) || par.sig != 1 || par.le != 1 || par.rate != 44100 || par.rchan != channels) {
|
||||
+ fprintf(stderr, __FILE__": Could not set required audio parameters\n");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ if (!sio_start(hdl)) {
|
||||
+ fprintf(stderr, __FILE__": sio_start() failed\n");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ n = 0;
|
||||
+ while (audio->terminate != 1) {
|
||||
+ if (sio_read(hdl, buf, sizeof(buf)) == 0) {
|
||||
+ fprintf(stderr, __FILE__": sio_read() failed: %s\n", strerror(errno));
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < sizeof(buf)/sizeof(buf[0]); i += 2) {
|
||||
+ if (par.rchan == 1) {
|
||||
+ // sndiod has already taken care of averaging the samples
|
||||
+ audio->audio_out_l[n] = buf[i];
|
||||
+ } else if (par.rchan == 2) {
|
||||
+ audio->audio_out_l[n] = buf[i];
|
||||
+ audio->audio_out_r[n] = buf[i + 1];
|
||||
+ }
|
||||
+ n = (n + 1) % 2048;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ sio_stop(hdl);
|
||||
+ sio_close(hdl);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
@ -1,5 +1,5 @@
|
||||
C.A.V.A. is a bar spectrum audio visualizer for the terminal using
|
||||
ALSA, PulseAudio, sndio or fifo buffer for input.
|
||||
PulseAudio, sndio or fifo buffer for input.
|
||||
|
||||
This program is not intended for scientific use. It's written to look
|
||||
responsive and aesthetic when used to visualize music.
|
||||
|
@ -1,2 +0,0 @@
|
||||
bin/cava
|
||||
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/config
|
Loading…
Reference in New Issue
Block a user