From 6941bde7796b56b8b60652b059c28db715cbba53 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Mon, 31 Jul 2017 00:36:09 +0900 Subject: autoconf update --- gtk/configure.ac | 39 +++++++++++++++++++++++++++++++++++---- soundout/pulseout.c | 13 ++++++++++--- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/gtk/configure.ac b/gtk/configure.ac index fc79c8c..67889e5 100644 --- a/gtk/configure.ac +++ b/gtk/configure.ac @@ -6,14 +6,45 @@ AC_PROG_RANLIB AM_PROG_AR AM_PROG_AS -PKG_CHECK_MODULES([JACK], [jack soxr], [jack_found=yes], [jack_found=no]) -PKG_CHECK_MODULES([PULSE], [libpulse], [pulse_found=yes], [pulse_found=no]) -PKG_CHECK_MODULES([ALSA], [alsa], [alsa_found=yes], [alsa_found=no]) +AC_ARG_WITH([jack], + [AS_HELP_STRING([--without-jack], [disable support for JACK audio])]) +AC_ARG_WITH([pulse], + [AS_HELP_STRING([--without-pulse], [disable support for pulseaudio])]) +AC_ARG_WITH([alsa], + [AS_HELP_STRING([--without-alsa], [disable support for alsa])]) + +AS_IF([test "x$with_jack" = "xyes"], [ + PKG_CHECK_MODULES([JACK], [jack soxr]) + jack_found=yes +], [test "x$with_jack" != "xno"], [ + PKG_CHECK_MODULES([JACK], [jack soxr], [jack_found=yes], [jack_found=no]) +], [ + jack_found=no +]) + +AS_IF([test "x$with_pulse" = "xyes"], [ + PKG_CHECK_MODULES([PULSE], [libpulse]) + pulse_found=yes +], [test "x$with_pulse" != "xno"], [ + PKG_CHECK_MODULES([PULSE], [libpulse], [pulse_found=yes], [pulse_found=no]) +], [ + pulse_found=no +]) + +AS_IF([test "x$with_alsa" = "xyes"], [ + PKG_CHECK_MODULES([ALSA], [alsa]) + alsa_found=yes +], [test "x$with_alsa" != "xno"], [ + PKG_CHECK_MODULES([ALSA], [alsa], [alsa_found=yes], [alsa_found=no]) +], [ + alsa_found=no +]) + PKG_CHECK_MODULES([GTK3], [gtk+-3.0 cairo]) PKG_CHECK_MODULES([SNDFILE], [sndfile]) AS_IF([test "x$jack_found" = "xno" -a "x$pulse_found" = "xno" -a "x$alsa_found" = "xno"], [ - AC_MSG_ERROR([No audio output backend found]) + AC_MSG_ERROR([No audio output backend found or enabled]) ]) AM_CONDITIONAL([ENABLE_JACK], [test "x$jack_found" = "xyes"]) diff --git a/soundout/pulseout.c b/soundout/pulseout.c index 5734991..1104ad0 100644 --- a/soundout/pulseout.c +++ b/soundout/pulseout.c @@ -47,7 +47,7 @@ static void pulseout_pause(struct sound_state *ss, int pause, int flush) { pa_threaded_mainloop_wait(ps->pa_tm); pa_operation_unref(op_flush); } else { - fprintf(stderr, "FLUSH ERR\n"); + //fprintf(stderr, "FLUSH ERR\n"); } } pa_operation *op_cork = pa_stream_cork(ps->pa_s, 0, pulseout_success_cb, ps); @@ -56,7 +56,7 @@ static void pulseout_pause(struct sound_state *ss, int pause, int flush) { pa_threaded_mainloop_wait(ps->pa_tm); pa_operation_unref(op_cork); } else { - fprintf(stderr, "CORK ERR\n"); + //fprintf(stderr, "CORK ERR\n"); } pa_threaded_mainloop_unlock(ps->pa_tm); } @@ -156,7 +156,14 @@ struct sound_state *pulseout_init( ); if (!ps->pa_s) goto err; pa_stream_set_write_callback(ps->pa_s, pulseout_cb, ps); - if (pa_stream_connect_playback(ps->pa_s, 0, 0, 0, 0, 0) < 0) goto err; + pa_buffer_attr battr = { + .maxlength = -1, + .tlength = pa_usec_to_bytes(1000*1000/30, &ss), + .prebuf = -1, + .minreq = -1, + .fragsize = -1, + }; + if (pa_stream_connect_playback(ps->pa_s, 0, &battr, PA_STREAM_ADJUST_LATENCY, 0, 0) < 0) goto err; return &ps->ss; err: pulseout_free(&ps->ss); -- cgit v1.2.3