- make it use portaudio v19; i.e. full-duplex support!

committing on behalf of jakemsr@ who did all the work
This commit is contained in:
ajacoutot 2007-11-23 10:07:40 +00:00
parent e9a758af64
commit 10f32495e6
11 changed files with 231 additions and 181 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.12 2007/11/13 12:44:22 steven Exp $ # $OpenBSD: Makefile,v 1.13 2007/11/23 10:07:40 ajacoutot Exp $
COMMENT= free audio editor COMMENT= free audio editor
V= 1.3.3 V= 1.3.3
DISTNAME= audacity-src-${V} DISTNAME= audacity-src-${V}
PKGNAME= audacity-${V}p2 PKGNAME= audacity-${V}p3
CATEGORIES= audio CATEGORIES= audio
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=audacity/} MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=audacity/}
@ -23,12 +23,13 @@ WANTLIB= c m ossaudio pthread stdc++ ogg expat sndfile glib-2.0 \
gobject-2.0 gtk-x11-2.0 gobject-2.0 gtk-x11-2.0
BUILD_DEPENDS= ::archivers/zip BUILD_DEPENDS= ::archivers/zip
LIB_DEPENDS= wx_base_xml,wx_base_odbc,wx_gtk2_html,wx_gtk2_adv,wx_gtk2_xrc,wx_base_net,wx_gtk2_dbgrid,wx_gtk2_qa,wx_base,wx_gtk2_core,wx_gtk2_aui:wxWidgets-gtk2->=2.6.3:x11/wxWidgets \ LIB_DEPENDS= wx_base_xml,wx_base_odbc,wx_gtk2_aui,wx_gtk2_html,wx_gtk2_adv,wx_gtk2_xrc,wx_base_net,wx_gtk2_dbgrid,wx_gtk2_qa,wx_base,wx_gtk2_core:wxWidgets-gtk2->=2.8.6:x11/wxWidgets \
samplerate.>=1::audio/libsamplerate \ samplerate.>=1::audio/libsamplerate \
FLAC.>=8,FLAC++.>=7::audio/flac \ FLAC.>=8,FLAC++.>=7::audio/flac \
vorbis.>=5,vorbisfile.>=4,vorbisenc.>=2::audio/libvorbis \ vorbis.>=5,vorbisfile.>=4,vorbisenc.>=2::audio/libvorbis \
id3tag.>=2::audio/libid3tag \ id3tag.>=2::audio/libid3tag \
mad.>=2::audio/libmad mad.>=2::audio/libmad \
portaudio::audio/portaudio-svn
RUN_DEPENDS= :desktop-file-utils-*:devel/desktop-file-utils RUN_DEPENDS= :desktop-file-utils-*:devel/desktop-file-utils
USE_X11= Yes USE_X11= Yes
@ -57,7 +58,8 @@ CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--with-ladspa \ --with-ladspa \
--with-portmixer \ --with-portmixer \
--with-soundtouch=local \ --with-soundtouch=local \
--with-portaudio=v18 \ --with-portaudio=v19 \
--with-pa-include=${LOCALBASE}/include \
--with-help --with-help
MAKE_FLAGS= CC="${CC}" MAKE_FLAGS= CC="${CC}"

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure,v 1.7 2007/09/18 18:27:00 mgrimm Exp $ $OpenBSD: patch-configure,v 1.8 2007/11/23 10:07:41 ajacoutot Exp $
--- configure.orig Fri May 18 06:56:02 2007 --- configure.orig Thu May 17 21:56:02 2007
+++ configure Sun Sep 16 10:52:20 2007 +++ configure Sat Oct 27 03:12:09 2007
@@ -4316,13 +4316,13 @@ else @@ -4316,13 +4316,13 @@ else
fi; fi;
@ -68,7 +68,34 @@ $OpenBSD: patch-configure,v 1.7 2007/09/18 18:27:00 mgrimm Exp $
LIBFLAC_SYSTEM_CPPSYMBOLS="USE_LIBFLAC" LIBFLAC_SYSTEM_CPPSYMBOLS="USE_LIBFLAC"
{ echo "$as_me:$LINENO: FLAC libraries are available as system libraries" >&5 { echo "$as_me:$LINENO: FLAC libraries are available as system libraries" >&5
echo "$as_me: FLAC libraries are available as system libraries" >&6;} echo "$as_me: FLAC libraries are available as system libraries" >&6;}
@@ -8516,7 +8516,7 @@ echo "$as_me: WARNING: no configuration information is @@ -6293,6 +6293,7 @@ cat >>confdefs.h <<\_ACEOF
#define USE_PORTAUDIO_V19 1
_ACEOF
+if [ x"no" = x"yes" ] ; then
BUILDLIBS="$BUILDLIBS portaudio-v19/lib/libportaudio.a"
EXTRAOBJS="$EXTRAOBJS ../lib-src/portaudio-v19/lib/libportaudio.a"
@@ -6731,6 +6732,9 @@ done
;;
esac
+fi
+
+
else
CXXFLAGS="-I\$(top_srcdir)/lib-src/portaudio/pa_common $CXXFLAGS"
@@ -6786,7 +6790,7 @@ _ACEOF
subdirs="$subdirs lib-src/portmixer"
- ac_configure_args="$ac_configure_args --with-pa-include=../portaudio-v19/include"
+ # ac_configure_args="$ac_configure_args --with-pa-include=../portaudio-v19/include"
else
CXXFLAGS="-I\$(top_srcdir)/lib-src/portmixer/px_common $CXXFLAGS"
@@ -8516,7 +8520,7 @@ echo "$as_me: WARNING: no configuration information is
{ echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
# The eval makes quoting arguments work. # The eval makes quoting arguments work.
@ -77,12 +104,16 @@ $OpenBSD: patch-configure,v 1.7 2007/09/18 18:27:00 mgrimm Exp $
--cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
{ { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
@@ -8532,7 +8532,7 @@ pa_libs= @@ -8530,9 +8534,10 @@ fi
pa_libs=
if [ "$use_portaudio" = "v19" ] ; then if [ "$use_portaudio" = "v19" ] ; then
pa_libs=`grep 'Libs:' lib-src/portaudio-v19/portaudio-2.0.pc | sed -e 's/Libs://;s/-L${libdir}//;s/-lportaudio//'` - pa_libs=`grep 'Libs:' lib-src/portaudio-v19/portaudio-2.0.pc | sed -e 's/Libs://;s/-L${libdir}//;s/-lportaudio//'`
+ # pa_libs=`grep 'Libs:' lib-src/portaudio-v19/portaudio-2.0.pc | sed -e 's/Libs://;s/-L${libdir}//;s/-lportaudio//'`
+ pa_libs="`pkg-config --libs portaudio-2.0`"
fi fi
-sed -i -e "s/@PA_LIBS@/$pa_libs/" src/Makefile -sed -i -e "s/@PA_LIBS@/$pa_libs/" src/Makefile
+perl -pi -e "s/\@PA_LIBS\@/$pa_libs/" src/Makefile +perl -pi -e "s#\@PA_LIBS\@#$pa_libs#" src/Makefile
echo "" echo ""
echo "Finished configure:" echo "Finished configure:"

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-lib-src_portaudio_pa_unix_oss_Makefile_in,v 1.1 2006/10/12 14:26:04 alek Exp $
--- lib-src/portaudio/pa_unix_oss/Makefile.in.orig Sat Oct 7 17:20:37 2006
+++ lib-src/portaudio/pa_unix_oss/Makefile.in Sat Oct 7 17:20:39 2006
@@ -5,7 +5,7 @@ srcdir=@srcdir@
DIRS=../pa_common
-override CFLAGS += -g -O -I$(srcdir)/../pa_common
+override CFLAGS += -I$(srcdir)/../pa_common
PASRC = $(srcdir)/../pa_common/pa_lib.c $(srcdir)/pa_unix_oss.c $(srcdir)/pa_unix.c
PAINC = $(srcdir)/../pa_common/portaudio.h
PAOBJ = ../pa_common/pa_lib.o pa_unix_oss.o pa_unix.o

View File

@ -1,49 +0,0 @@
$OpenBSD: patch-lib-src_portaudio_pa_unix_oss_pa_unix_c,v 1.3 2007/06/06 09:35:18 ajacoutot Exp $
--- lib-src/portaudio/pa_unix_oss/pa_unix.c.orig Wed Mar 28 09:22:39 2007
+++ lib-src/portaudio/pa_unix_oss/pa_unix.c Wed Mar 28 09:26:18 2007
@@ -399,6 +399,7 @@ static int PaHost_CanaryProc( PaHostSoundControl *pa
return result;
}
+#if 0
/*******************************************************************************************
* Monitor audio thread and lower its it if it hogs the CPU.
* To prevent getting killed, the audio thread must update a
@@ -598,6 +599,7 @@ static PaError PaHost_BoostPriority( internalPortAudio
return result;
}
+#endif /* Watchdog */
/*******************************************************************************************/
static PaError Pa_AudioThreadProc( internalPortAudioStream *past )
@@ -613,8 +615,10 @@ static PaError Pa_AudioThreadProc( internalPortAudioSt
GSRegisterCurrentThread(); /* SB20010904 */
#endif
+#if 0
result = PaHost_BoostPriority( past );
if( result < 0 ) goto error;
+#endif
past->past_IsActive = 1;
DBUG(("entering thread.\n"));
@@ -680,7 +684,9 @@ static PaError Pa_AudioThreadProc( internalPortAudioSt
DBUG(("Pa_AudioThreadProc: left audio loop.\n"));
past->past_IsActive = 0;
+#if 0
PaHost_StopWatchDog( pahsc );
+#endif
error:
DBUG(("leaving audio thread.\n"));
@@ -810,7 +816,7 @@ PaError PaHost_OpenStream( internalPortAudioStream *
past->past_NumUserBuffers, past->past_FramesPerUserBuffer,
past->past_NumOutputChannels );
result = Pa_SetupDeviceFormat( pahsc->pahsc_OutputHandle,
- past->past_NumOutputChannels, (int)past->past_SampleRate );
+ past->past_NumOutputChannels, (int)past->past_SampleRate, 2 );
}
}
else

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-lib-src_portaudio_pa_unix_oss_pa_unix_h,v 1.1.1.1 2006/01/12 08:59:27 steven Exp $
--- lib-src/portaudio/pa_unix_oss/pa_unix.h.orig Tue Jan 11 13:52:20 2005
+++ lib-src/portaudio/pa_unix_oss/pa_unix.h Tue Jan 11 13:52:53 2005
@@ -133,7 +133,7 @@ PaHostSoundControl;
internalPortAudioDevice *Pa_GetInternalDevice( PaDeviceID id );
PaError Pa_QueryDevices( void );
PaError Pa_QueryDevice( const char *deviceName, internalPortAudioDevice *pad );
-PaError Pa_SetupDeviceFormat( int devHandle, int numChannels, int sampleRate );
+PaError Pa_SetupDeviceFormat( int devHandle, int numChannels, int sampleRate, int input );
PaError Pa_SetupInputDeviceFormat( int devHandle, int numChannels, int sampleRate );
PaError Pa_SetupOutputDeviceFormat( int devHandle, int numChannels, int sampleRate );
void Pa_SetLatency( int devHandle, int numBuffers, int framesPerBuffer, int channelsPerFrame );

View File

@ -1,84 +0,0 @@
$OpenBSD: patch-lib-src_portaudio_pa_unix_oss_pa_unix_oss_c,v 1.4 2007/06/06 09:35:18 ajacoutot Exp $
--- lib-src/portaudio/pa_unix_oss/pa_unix_oss.c.orig Wed Mar 28 09:27:12 2007
+++ lib-src/portaudio/pa_unix_oss/pa_unix_oss.c Wed Mar 28 09:29:36 2007
@@ -45,7 +45,8 @@
#elif defined(__FreeBSD__)
#include <sys/soundcard.h>
#else
-#include <machine/soundcard.h> /* JH20010905 */
+#include <soundcard.h> /* JH20010905 */
+#include <sys/audioio.h>
#endif
@@ -219,11 +220,15 @@ error:
}
/*******************************************************************************************/
-PaError Pa_SetupDeviceFormat( int devHandle, int numChannels, int sampleRate )
+PaError Pa_SetupDeviceFormat( int devHandle, int numChannels, int sampleRate, int input )
{
PaError result = paNoError;
int tmp;
+#ifdef __OpenBSD__
+ audio_info_t audio_if;
+#endif
+
/* Set format, channels, and rate in this order to keep OSS happy. */
/* Set data format. FIXME - handle more native formats. */
tmp = AFMT_S16_NE;
@@ -274,17 +279,51 @@ PaError Pa_SetupDeviceFormat( int devHandle, int numCh
}
}
+#ifdef __OpenBSD__
+
+ AUDIO_INITINFO(&audio_if);
+
+ switch(input) {
+ case 2:
+ audio_if.record.open = 1;
+ audio_if.record.pause = 0;
+ audio_if.play.open = 1;
+ audio_if.play.pause = 0;
+ break;
+
+ case 1:
+ audio_if.record.open = 1;
+ audio_if.record.pause = 0;
+ break;
+
+ case 0:
+ audio_if.play.open = 1;
+ audio_if.play.pause = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (ioctl(devHandle, AUDIO_SETINFO, &audio_if) == -1)
+ {
+ ERR_RPT(("Pa_SetupDeviceFormat: could not AUDIO_SETINFO for recording on OpenBSD\n" ));
+ return paHostError;
+ }
+
+#endif
+
return result;
}
PaError Pa_SetupOutputDeviceFormat( int devHandle, int numChannels, int sampleRate )
{
- return Pa_SetupDeviceFormat(devHandle, numChannels, sampleRate);
+ return Pa_SetupDeviceFormat(devHandle, numChannels, sampleRate, 0);
}
PaError Pa_SetupInputDeviceFormat( int devHandle, int numChannels, int sampleRate )
{
- return Pa_SetupDeviceFormat(devHandle, numChannels, sampleRate);
+ return Pa_SetupDeviceFormat(devHandle, numChannels, sampleRate, 1);
}

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-lib-src_portmixer_configure,v 1.1 2007/11/23 10:07:41 ajacoutot Exp $
--- lib-src/portmixer/configure.orig Thu May 17 21:55:50 2007
+++ lib-src/portmixer/configure Sun Oct 28 03:28:14 2007
@@ -2827,6 +2827,11 @@ fi
#
# Make sure the support is there
#
+
+# skip test for now
+
+if [ x"yes" = x"no" ]; then
+
have_support=yes
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -2919,6 +2924,9 @@ echo "$as_me: error: \"You're version of portaudio doe
{ (exit 1); exit 1; }; };
fi
+# end skip test
+fi
+
#
#
#
@@ -3429,7 +3437,7 @@ else
have_coreaudio=no
fi
-
+have_oss=yes
#
# Set up to use the identified ones

View File

@ -0,0 +1,45 @@
$OpenBSD: patch-lib-src_portmixer_src_px_mixer_c,v 1.1 2007/11/23 10:07:41 ajacoutot Exp $
--- lib-src/portmixer/src/px_mixer.c.orig Thu May 17 21:55:50 2007
+++ lib-src/portmixer/src/px_mixer.c Sun Oct 28 02:48:11 2007
@@ -35,7 +35,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-#include "portaudio.h"
+#include <portaudio.h>
#include "portmixer.h"
#include "px_mixer.h"
@@ -122,6 +122,9 @@ PxMixer *Px_OpenMixer(PaStream *pa_stream, int i)
return NULL;
}
+
+#ifdef PX_USE_PA_V18
+
switch (Pa_GetStreamHostApiType(pa_stream))
{
#if defined(PX_USE_WIN_MME)
@@ -154,6 +157,22 @@ PxMixer *Px_OpenMixer(PaStream *pa_stream, int i)
break;
#endif
}
+
+#else /* PX_USE_PA_V18 */
+
+#if defined(PX_USE_UNIX_OSS)
+ good = OpenMixer_Unix_OSS(Px, i);
+#elif defined(PX_USE_WIN_MME)
+ good = OpenMixer_Win_MME(Px, i);
+#elif defined(PX_USE_WIN_DSOUND)
+ good = OpenMixer_Win_DirectSound(Px, i);
+#elif defined(PX_USE_MAC_COREAUDIO)
+ good = OpenMixer_Mac_CoreAudio(Px, i);
+#elif defined(PX_USE_LINUX_ALSA)
+ good = OpenMixer_Linux_ALSA(Px, i);
+#endif
+
+#endif /* PX_USE_PA_V18 */
if (!good) {
free(Px);

View File

@ -0,0 +1,76 @@
$OpenBSD: patch-lib-src_portmixer_src_px_unix_oss_c,v 1.1 2007/11/23 10:07:41 ajacoutot Exp $
--- lib-src/portmixer/src/px_unix_oss.c.orig Thu May 17 21:55:50 2007
+++ lib-src/portmixer/src/px_unix_oss.c Sun Oct 28 14:39:03 2007
@@ -41,8 +41,12 @@
#elif defined(__FreeBSD__)
#include <sys/soundcard.h>
#else
+#if defined(__OpenBSD__)
+#include <soundcard.h>
+#else
#include <machine/soundcard.h> /* JH20010905 */
#endif
+#endif
#include <stdio.h>
#include <stdlib.h>
@@ -52,9 +56,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <ctype.h>
#include "portaudio.h"
+#ifdef PX_USE_PA_V18
#include "pa_unix_oss.h"
+#endif
#include "portmixer.h"
#include "px_mixer.h"
@@ -97,7 +104,7 @@ static int open_mixer(PxDev *dev, int cmd)
int i;
int id = 0;
- for (i = strlen(dev->name) - 1; i >= 0; i++) {
+ for (i = strlen(dev->name) - 1; i >= 0; i--) {
if (!isdigit(dev->name[i])) {
break;
}
@@ -108,11 +115,9 @@ static int open_mixer(PxDev *dev, int cmd)
return -1;
}
- strcpy(name, MIXER_NAME_BASE);
- if (id == 0)
- name[strlen(MIXER_NAME_BASE)] = 0;
- else
- name[strlen(MIXER_NAME_BASE)] = '0' + (id - 1);
+ strlcpy(name, MIXER_NAME_BASE, sizeof(name));
+ if (id != 0)
+ strlcat(name, &dev->name[i + 1], sizeof(name));
do {
dev->fd = open(name, O_RDWR);
@@ -161,14 +166,22 @@ int OpenMixer_Unix_OSS(px_mixer *Px, int index)
info->playback.num = 0;
do {
+#ifdef PX_USE_PA_V18
info->capture.name = PaOSS_GetInputDevice(Px->pa_stream);
+#else
+ info->capture.name = (Pa_GetDeviceInfo(index))->name;
+#endif
if (info->capture.name) {
if (!open_mixer(&info->capture, SOUND_MIXER_READ_RECMASK)) {
break;
}
}
+#ifdef PX_USE_PA_V18
info->playback.name = PaOSS_GetOutputDevice(Px->pa_stream);
+#else
+ info->playback.name = (Pa_GetDeviceInfo(index))->name;
+#endif
if (info->playback.name) {
if (!open_mixer(&info->playback, SOUND_MIXER_READ_DEVMASK)) {
break;

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-src_AudioIO_cpp,v 1.1 2007/11/23 10:07:41 ajacoutot Exp $
--- src/AudioIO.cpp.orig Thu May 17 21:55:57 2007
+++ src/AudioIO.cpp Sun Oct 28 17:26:33 2007
@@ -479,7 +479,7 @@ void AudioIO::HandleDeviceChange()
if( error )
return;
- mPortMixer = Px_OpenMixer(stream, 0);
+ mPortMixer = Px_OpenMixer(stream, recDeviceNum);
if (!mPortMixer) {
Pa_CloseStream(stream);
@@ -667,7 +667,8 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
}
mPortMixer = NULL;
if (mPortStreamV19 != NULL && mLastPaError == paNoError) {
- mPortMixer = Px_OpenMixer(mPortStreamV19, 0);
+ mPortMixer = Px_OpenMixer(mPortStreamV19, captureParameters != NULL ?
+ captureParameters->device : playbackParameters->device);
#ifdef __MACOSX__
if (mPortMixer) {
@@ -770,7 +771,7 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
}
mPortMixer = NULL;
if (mPortStreamV18 != NULL && mLastPaError == paNoError) {
- mPortMixer = Px_OpenMixer(mPortStreamV18, 0);
+ mPortMixer = Px_OpenMixer(mPortStreamV18, captureDevice);
#ifdef __MACOSX__
if (mPortMixer) {

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_Makefile_in,v 1.5 2007/06/06 09:35:18 ajacoutot Exp $
--- src/Makefile.in.orig Tue Jun 5 10:59:23 2007
+++ src/Makefile.in Tue Jun 5 10:59:40 2007
@@ -20,7 +20,7 @@ PRECOMP_CFLAGS = @PRECOMP_CFLAGS@
LOCAL_LIBS = @LOCAL_LIBS@
EXTRAOBJS = @EXTRAOBJS@
EXTRATARGETS = @EXTRATARGETS@
-LIBS = @LIBS@ @PA_LIBS@
+LIBS = @LIBS@
DIRS=blockfile commands effects effects/ladspa effects/nyquist export import prefs toolbars widgets xml
srcdir=@srcdir@