diff --git a/Makefile.in b/Makefile.in index 06997dedf..2c29e20a7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,7 +15,7 @@ CUDA_FLAGS = @CUDA_FLAGS@ @CUDA_COMPUTE_ARGS@ LDFLAGS = @LDFLAGS@ LIBS += @LIBS@ @MATHLIBS@ -lm -pthread INC = -Isrc -I$(srcdir) -I$(srcdir)/src -I$(srcdir)/test -Idxt_compress \ - @SPEEX_INC@ @CUDA_INC@ @INC@ + @CUDA_INC@ @INC@ DECKLINK_PATH = @DECKLINK_PATH@ DYLIBBUNDLER = @DYLIBBUNDLER@ DYLIBBUNDLER_FLAGS += @DYLIBBUNDLER_FLAGS@ @@ -27,7 +27,6 @@ GUI_BUNDLE = gui/QT/uv-qt.app DXT_GLSL_CFLAGS = @DXT_GLSL_CFLAGS@ CUDA_COMPILER = @CUDA_COMPILER@ SYSTEM = @system@ -SPEEX_PATH = @SPEEX_PATH@ SPEEXDSP_PATH = @SPEEXDSP_PATH@ GUI_EXE = @GUI_EXE@ @@ -100,7 +99,7 @@ COMMON_OBJS = \ src/audio/utils.o \ src/audio/wav_reader.o \ @JACK_TRANS_OBJ@ \ - @SPEEX_OBJ@ \ + @SPEEXDSP_OBJ@ \ src/capture_filter.o \ src/capture_filter/change_pixfmt.o \ src/capture_filter/every.o \ @@ -300,11 +299,11 @@ src/audio/filterbank.o: src/audio/fftwrap.o: $(MKDIR_P) $(dir $@) - $(CC) $(CFLAGS) $(SPEEX_FLAGS) $(INC) -DUSE_SMALLFT -DEXPORT="" -DRANDOM_PREFIX=speex -DFLOATING_POINT -DDISABLE_WARNINGS -I. -I $(srcdir)/$(SPEEX_PATH)/include/speex -Iinclude -fvisibility=hidden -c $(srcdir)/$(SPEEXDSP_PATH)/libspeexdsp/fftwrap.c -fPIC -DPIC -o $@ + $(CC) $(CFLAGS) $(SPEEX_FLAGS) $(INC) -DUSE_SMALLFT -DEXPORT="" -DRANDOM_PREFIX=speex -DFLOATING_POINT -DDISABLE_WARNINGS -I. -I $(srcdir)/$(SPEEXDSP_PATH)/include/speex -Iinclude -fvisibility=hidden -c $(srcdir)/$(SPEEXDSP_PATH)/libspeexdsp/fftwrap.c -fPIC -DPIC -o $@ src/audio/smallft.o: $(MKDIR_P) $(dir $@) - $(CC) $(CFLAGS) $(SPEEX_FLAGS) $(INC) -DEXPORT="" -DRANDOM_PREFIX=speex -DFIXED_POINT -DDISABLE_WARNINGS -I. -I $(srcdir)/$(SPEEX_PATH)/include/speex -Iinclude -fvisibility=hidden -c $(srcdir)/$(SPEEXDSP_PATH)/libspeexdsp/smallft.c -fPIC -DPIC -o $@ + $(CC) $(CFLAGS) $(SPEEX_FLAGS) $(INC) -DEXPORT="" -DRANDOM_PREFIX=speex -DFIXED_POINT -DDISABLE_WARNINGS -I. -I $(srcdir)/$(SPEEXDSP_PATH)/include/speex -Iinclude -fvisibility=hidden -c $(srcdir)/$(SPEEXDSP_PATH)/libspeexdsp/smallft.c -fPIC -DPIC -o $@ src/audio/mdf.o: $(MKDIR_P) $(dir $@) diff --git a/configure.ac b/configure.ac index 5075321c3..c6739dcc9 100644 --- a/configure.ac +++ b/configure.ac @@ -2487,28 +2487,28 @@ if test $portaudio_req = yes -a $portaudio = no; then AC_MSG_ERROR([PortAudio not found]); fi -# ------------------------------------------------------------------------------------------------- -# SPEEX - -speex=yes +# --------------------------------------------------------------------------- +# SpeexDSP +# --------------------------------------------------------------------------- +speexdsp=yes SPEEXDSP_PATH=ext-deps/speexdsp -SPEEX_INC= -SPEEX_OBJ=src/audio/echo.o -AC_DEFINE([HAVE_SPEEX], [1], [Build with SPEEX support]) +SPEEXDSP_INC= +SPEEXDSP_OBJ=src/audio/echo.o +AC_DEFINE([HAVE_SPEEXDSP], [1], [Build with SpeexDSP support]) PKG_CHECK_MODULES([LIBSPEEXDSP], [speexdsp], [found_speexdsp=yes], [found_speexdsp=no]) if test "$found_speexdsp" = yes; then LIBS="$LIBS $LIBSPEEXDSP_LIBS" else - SPEEX_INC="$SPEEX_INC -I$srcdir/${SPEEXDSP_PATH}/include" - SPEEX_OBJ="$SPEEX_OBJ src/audio/fftwrap.o src/audio/filterbank.o src/audio/mdf.o src/audio/preprocess.o src/audio/resample.o src/audio/smallft.o" + SPEEXDSP_INC="$SPEEXDSP_INC -I$srcdir/${SPEEXDSP_PATH}/include" + SPEEXDSP_OBJ="$SPEEXDSP_OBJ src/audio/fftwrap.o src/audio/filterbank.o src/audio/mdf.o src/audio/preprocess.o src/audio/resample.o src/audio/smallft.o" fi SAVED_CFLAGS=$CFLAGS SAVED_CPPFLAGS=$CPPFLAGS -CFLAGS="$CFLAGS $SPEEX_INC" -CPPFLAGS="$CPPFLAGS $SPEEX_INC" +CFLAGS="$CFLAGS $SPEEXDSP_INC" +CPPFLAGS="$CPPFLAGS $SPEEXDSP_INC" AC_CHECK_HEADER([speex/speex_resampler.h]) CFLAGS=$SAVED_CFLAGS CPPFLAGS=$SAVED_CPPFLAGS @@ -2518,10 +2518,9 @@ if test "$ac_cv_header_speex_speex_resampler_h" != yes; then [This should be usually automatic - please report to $PACKAGE_BUGREPORT if not sure why getting this.]); fi +INC="$INC${SPEEXDSP_INC:+${INC:+ }}$SPEEXDSP_INC" -AC_SUBST(SPEEX_INC) -AC_SUBST(SPEEX_OBJ) -AC_SUBST(SPEEX_PATH) +AC_SUBST(SPEEXDSP_OBJ) AC_SUBST(SPEEXDSP_PATH) # ------------------------------------------------------------------------------------------------- @@ -2567,10 +2566,10 @@ then ADD_MODULE("aplay_jack", "$JACK_PLAY_OBJ", "") fi -if test $jack = yes -a $speex = no +if test $jack = yes -a $speexdsp = no then - AC_MSG_WARN([*** You are going to compile JACK but you do not have SPEEX compiled in. - It is recommended to compile also SPEEX library and rerun this script in + AC_MSG_WARN([*** You are going to compile JACK but you do not have SpeexDSP compiled in. + It is recommended to compile also SpeexDSP library and rerun this script in order to enable resampling (if needed).]) fi @@ -2635,10 +2634,10 @@ case $host_os in ;; esac -if test $coreaudio = yes -a $speex = no +if test $coreaudio = yes -a $speexdsp = no then - AC_MSG_WARN([*** You are going to compile CoreAudio but you do not have SPEEX compiled in. - It is recommended to compile also SPEEX library and rerun this script in + AC_MSG_WARN([*** You are going to compile CoreAudio but you do not have SpeexDSP compiled in. + It is recommended to compile also SpeexDSP library and rerun this script in order to enable resampling (if needed).]) fi diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index ffa6887b5..5d9b04dfb 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -280,7 +280,7 @@ struct state_audio * audio_cfg_init(struct module *parent, const char *addrs, in s->exporter = exporter; if(echo_cancellation) { -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP //s->echo_state = echo_cancellation_init(); fprintf(stderr, "Echo cancellation is currently broken " "in UltraGrid.\nPlease write to %s " @@ -291,7 +291,7 @@ struct state_audio * audio_cfg_init(struct module *parent, const char *addrs, in fprintf(stderr, "Speex not compiled in. Could not enable echo cancellation.\n"); delete s; goto error; -#endif /* HAVE_SPEEX */ +#endif /* HAVE_SPEEXDSP */ } else { s->echo_state = NULL; } @@ -723,7 +723,7 @@ static void *audio_receiver_thread(void *arg) if (decoded) { bool failed = false; if(s->echo_state) { -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP echo_play(s->echo_state, ¤t_pbuf->buffer); #endif } @@ -981,7 +981,7 @@ static void *audio_sender_thread(void *arg) } export_audio(s->exporter, buffer); if(s->echo_state) { -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP buffer = echo_cancel(s->echo_state, buffer); if(!buffer) continue; diff --git a/src/audio/capture/coreaudio.m b/src/audio/capture/coreaudio.m index b26a53785..d9f598344 100644 --- a/src/audio/capture/coreaudio.m +++ b/src/audio/capture/coreaudio.m @@ -50,7 +50,7 @@ #include #include -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP #include #endif @@ -75,7 +75,7 @@ struct state_ca_capture { auHALComponentInstance; struct audio_frame frame; char *tmp; -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP char *resampled; #endif struct ring_buffer *buffer; @@ -87,7 +87,7 @@ struct state_ca_capture { volatile int boss_waiting; volatile int data_ready; int nominal_sample_rate; -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP SpeexResamplerState *resampler; #endif }; @@ -160,7 +160,7 @@ static OSStatus InputProc(void *inRefCon, for(i = 0; i < s->frame.ch_count; ++i) mux_channel(s->tmp, s->theBufferList->mBuffers[i].mData, s->frame.bps, len, s->frame.ch_count, i, 1.0); uint32_t write_bytes = len * s->frame.ch_count; -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP if(s->nominal_sample_rate != s->frame.sample_rate) { int err; uint32_t in_frames = inNumberFrames; @@ -175,7 +175,7 @@ static OSStatus InputProc(void *inRefCon, #endif pthread_mutex_lock(&s->lock); -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP if(s->nominal_sample_rate != s->frame.sample_rate) ring_buffer_write(s->buffer, s->resampled, write_bytes); else @@ -284,9 +284,9 @@ static void * audio_cap_ca_init(const char *cfg) s->nominal_sample_rate = rate; s->frame.sample_rate = audio_capture_sample_rate ? audio_capture_sample_rate : rate; -#if !defined HAVE_SPEEX || defined DISABLE_SPPEX_RESAMPLER +#if !defined HAVE_SPEEXDSP || defined DISABLE_SPPEX_RESAMPLER s->frame.sample_rate = rate; -#if !defined HAVE_SPEEX +#if !defined HAVE_SPEEXDSP fprintf(stderr, "[CoreAudio] Libspeex support not compiled in, resampling won't work (check manual or wiki how to enable it)!\n"); #endif #else @@ -308,7 +308,7 @@ static void * audio_cap_ca_init(const char *cfg) s->buffer = ring_buffer_init(s->frame.max_size); s->frame.data = (char *) malloc(s->frame.max_size); -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP s->resampled = (char *) malloc(s->frame.max_size); #endif @@ -511,12 +511,12 @@ static void audio_cap_ca_done(void *state) ring_buffer_destroy(s->buffer); free(s->tmp); -#ifdef HAVE_SPEEX +#ifdef HAVE_SPEEXDSP if(s->resampler) { speex_resampler_destroy(s->resampler); } free(s->resampled); -#endif // HAVE_SPEEX +#endif // HAVE_SPEEXDSP free(s); } diff --git a/src/audio/echo.c b/src/audio/echo.c index f103d87c4..d249a0715 100644 --- a/src/audio/echo.c +++ b/src/audio/echo.c @@ -45,9 +45,7 @@ #include "debug.h" #include "echo.h" -#ifdef HAVE_SPEEX -#include "speex/speex_echo.h" -#endif /* HAVE_SPEEX */ +#include #include #include