- revert to using portaudio v18 ; v19 has an endianness pbm which makes
powerpc dore dump
This commit is contained in:
parent
d05b070e0f
commit
5f50aebee8
@ -1,10 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.8 2007/06/06 09:35:18 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.9 2007/06/06 18:27:17 ajacoutot Exp $
|
||||
|
||||
COMMENT= "free audio editor"
|
||||
|
||||
V= 1.3.3
|
||||
DISTNAME= audacity-src-${V}
|
||||
PKGNAME= audacity-${V}
|
||||
PKGNAME= audacity-${V}p0
|
||||
CATEGORIES= audio
|
||||
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=audacity/}
|
||||
@ -57,7 +57,7 @@ CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
|
||||
--with-ladspa \
|
||||
--with-portmixer \
|
||||
--with-soundtouch=local \
|
||||
--with-portaudio=v19 \
|
||||
--with-portaudio=v18 \
|
||||
--with-help
|
||||
|
||||
MAKE_FLAGS= CC="${CC}"
|
||||
|
@ -1,300 +0,0 @@
|
||||
$OpenBSD: patch-lib-src_portaudio-v19_src_hostapi_oss_pa_unix_oss_c,v 1.1 2007/06/06 09:35:18 ajacoutot Exp $
|
||||
--- lib-src/portaudio-v19/src/hostapi/oss/pa_unix_oss.c.orig Fri May 18 06:55:49 2007
|
||||
+++ lib-src/portaudio-v19/src/hostapi/oss/pa_unix_oss.c Wed Jun 6 09:40:51 2007
|
||||
@@ -63,17 +63,11 @@
|
||||
#include <limits.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
-#ifdef __FreeBSD__
|
||||
-# include <sys/soundcard.h>
|
||||
-# define DEVICE_NAME_BASE "/dev/dsp"
|
||||
-#elif defined __linux__
|
||||
-# include <linux/soundcard.h>
|
||||
-# define DEVICE_NAME_BASE "/dev/dsp"
|
||||
-#else
|
||||
-# include <machine/soundcard.h> /* JH20010905 */
|
||||
-# define DEVICE_NAME_BASE "/dev/audio"
|
||||
-#endif
|
||||
+#include <sys/audioio.h>
|
||||
|
||||
+# include <soundcard.h>
|
||||
+# define DEVICE_NAME_BASE "/dev/audio"
|
||||
+
|
||||
#include "portaudio.h"
|
||||
#include "pa_util.h"
|
||||
#include "pa_allocation.h"
|
||||
@@ -86,6 +80,9 @@
|
||||
static int sysErr_;
|
||||
static pthread_t mainThread_;
|
||||
|
||||
+int trigger_input(int);
|
||||
+int trigger_output(int);
|
||||
+
|
||||
/* Check return value of system call, and map it to PaError */
|
||||
#define ENSURE_(expr, code) \
|
||||
do { \
|
||||
@@ -807,9 +804,7 @@ static PaError OpenDevices( const char *idevName, cons
|
||||
ENSURE_( *idev = open( idevName, flags ), paDeviceUnavailable );
|
||||
PA_ENSURE( ModifyBlocking( *idev, 1 ) ); /* Blocking */
|
||||
|
||||
- /* Initially disable */
|
||||
- enableBits = ~PCM_ENABLE_INPUT;
|
||||
- ENSURE_( ioctl( *idev, SNDCTL_DSP_SETTRIGGER, &enableBits ), paUnanticipatedHostError );
|
||||
+ trigger_input(*idev);
|
||||
}
|
||||
if( odevName )
|
||||
{
|
||||
@@ -818,13 +813,12 @@ static PaError OpenDevices( const char *idevName, cons
|
||||
ENSURE_( *odev = open( odevName, flags ), paDeviceUnavailable );
|
||||
PA_ENSURE( ModifyBlocking( *odev, 1 ) ); /* Blocking */
|
||||
|
||||
- /* Initially disable */
|
||||
- enableBits = ~PCM_ENABLE_OUTPUT;
|
||||
- ENSURE_( ioctl( *odev, SNDCTL_DSP_SETTRIGGER, &enableBits ), paUnanticipatedHostError );
|
||||
+ trigger_output(*odev);
|
||||
}
|
||||
else
|
||||
{
|
||||
ENSURE_( *odev = dup( *idev ), paUnanticipatedHostError );
|
||||
+ trigger_output(*odev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -984,7 +978,7 @@ static PaError PaOssStreamComponent_Configure( PaOssSt
|
||||
int frgmt;
|
||||
int numBufs;
|
||||
int bytesPerBuf;
|
||||
- double bufSz;
|
||||
+ unsigned long bufSz;
|
||||
unsigned long fragSz;
|
||||
audio_buf_info bufInfo;
|
||||
|
||||
@@ -997,13 +991,13 @@ static PaError PaOssStreamComponent_Configure( PaOssSt
|
||||
*/
|
||||
if( framesPerBuffer == paFramesPerBufferUnspecified )
|
||||
{
|
||||
- bufSz = component->latency * sampleRate;
|
||||
+ bufSz = (unsigned long)(component->latency * sampleRate);
|
||||
fragSz = bufSz / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
fragSz = framesPerBuffer;
|
||||
- bufSz = component->latency * sampleRate + fragSz; /* Latency + 1 buffer */
|
||||
+ bufSz = (unsigned long)(component->latency * sampleRate) + fragSz; /* Latency + 1 buffer */
|
||||
}
|
||||
|
||||
PA_ENSURE( GetAvailableFormats( component, &availableFormats ) );
|
||||
@@ -1076,7 +1070,10 @@ static PaError PaOssStreamComponent_Read( PaOssStreamC
|
||||
size_t len = *frames * PaOssStreamComponent_FrameSize( component );
|
||||
ssize_t bytesRead;
|
||||
|
||||
- ENSURE_( bytesRead = read( component->fd, component->buffer, len ), paUnanticipatedHostError );
|
||||
+ PA_ENSURE( ModifyBlocking(component->fd, 0 ) );
|
||||
+ bytesRead = read( component->fd, component->buffer, len );
|
||||
+ if (bytesRead == -1)
|
||||
+ goto error;
|
||||
*frames = bytesRead / PaOssStreamComponent_FrameSize( component );
|
||||
/* TODO: Handle condition where number of frames read doesn't equal number of frames requested */
|
||||
|
||||
@@ -1089,7 +1086,7 @@ static PaError PaOssStreamComponent_Write( PaOssStream
|
||||
PaError result = paNoError;
|
||||
size_t len = *frames * PaOssStreamComponent_FrameSize( component );
|
||||
ssize_t bytesWritten;
|
||||
-
|
||||
+ PA_ENSURE( ModifyBlocking(component->fd, 0 ) );
|
||||
ENSURE_( bytesWritten = write( component->fd, component->buffer, len ), paUnanticipatedHostError );
|
||||
*frames = bytesWritten / PaOssStreamComponent_FrameSize( component );
|
||||
/* TODO: Handle condition where number of frames written doesn't equal number of frames requested */
|
||||
@@ -1117,7 +1114,8 @@ static PaError PaOssStream_Configure( PaOssStream *str
|
||||
if( stream->capture )
|
||||
{
|
||||
PaOssStreamComponent *component = stream->capture;
|
||||
- PaOssStreamComponent_Configure( component, sampleRate, framesPerBuffer, StreamMode_In, NULL );
|
||||
+ PA_ENSURE( PaOssStreamComponent_Configure( component, sampleRate, framesPerBuffer, StreamMode_In,
|
||||
+ NULL ) );
|
||||
|
||||
assert( component->hostChannelCount > 0 );
|
||||
assert( component->hostFrames > 0 );
|
||||
@@ -1382,10 +1380,13 @@ static PaError PaOssStream_WaitForFrames( PaOssStream
|
||||
{
|
||||
ENSURE_( ioctl( captureFd, SNDCTL_DSP_GETISPACE, &bufInfo ), paUnanticipatedHostError );
|
||||
captureAvail = bufInfo.fragments * stream->capture->hostFrames;
|
||||
+
|
||||
+
|
||||
if( !captureAvail )
|
||||
PA_DEBUG(( "%s: captureAvail: 0\n", __FUNCTION__ ));
|
||||
|
||||
- captureAvail = captureAvail == 0 ? INT_MAX : captureAvail; /* Disregard if zero */
|
||||
+ /* SNDCTL_DSP_GETISPACE values are signed on OpenBSD */
|
||||
+ captureAvail = captureAvail <= 0 ? INT_MAX : captureAvail; /* Disregard if zero */
|
||||
}
|
||||
if( stream->playback )
|
||||
{
|
||||
@@ -1395,8 +1396,8 @@ static PaError PaOssStream_WaitForFrames( PaOssStream
|
||||
{
|
||||
PA_DEBUG(( "%s: playbackAvail: 0\n", __FUNCTION__ ));
|
||||
}
|
||||
-
|
||||
- playbackAvail = playbackAvail == 0 ? INT_MAX : playbackAvail; /* Disregard if zero */
|
||||
+ /* SNDCTL_DSP_GETOSPACE values are signed on OpenBSD */
|
||||
+ playbackAvail = playbackAvail <= 0 ? INT_MAX : playbackAvail; /* Disregard if zero */
|
||||
}
|
||||
|
||||
commonAvail = PA_MIN( captureAvail, playbackAvail );
|
||||
@@ -1426,38 +1427,35 @@ static PaError PaOssStream_Prepare( PaOssStream *strea
|
||||
|
||||
if( stream->playback )
|
||||
{
|
||||
- size_t bufSz = PaOssStreamComponent_BufferSize( stream->playback );
|
||||
- memset( stream->playback->buffer, 0, bufSz );
|
||||
+ size_t bufSz = PaOssStreamComponent_BufferSize( stream->playback );
|
||||
+ memset( stream->playback->buffer, 0, bufSz );
|
||||
|
||||
- /* Looks like we have to turn off blocking before we try this, but if we don't fill the buffer
|
||||
- * OSS will complain. */
|
||||
- PA_ENSURE( ModifyBlocking( stream->playback->fd, 0 ) );
|
||||
- while (1)
|
||||
- {
|
||||
- if( write( stream->playback->fd, stream->playback->buffer, bufSz ) < 0 )
|
||||
- break;
|
||||
- }
|
||||
- PA_ENSURE( ModifyBlocking( stream->playback->fd, 1 ) );
|
||||
+ /* Looks like we have to turn off blocking before we try this, but if we don't fill the buffer
|
||||
+ * OSS will complain. */
|
||||
+ PA_ENSURE( ModifyBlocking( stream->playback->fd, 0 ) );
|
||||
+ while (1)
|
||||
+ {
|
||||
+ if( write( stream->playback->fd, stream->playback->buffer, bufSz) < 0 )
|
||||
+ break;
|
||||
+ }
|
||||
+ PA_ENSURE( ModifyBlocking( stream->playback->fd, 1 ) );
|
||||
}
|
||||
|
||||
- if( stream->sharedDevice )
|
||||
+ if( stream->capture )
|
||||
{
|
||||
- enableBits = PCM_ENABLE_INPUT | PCM_ENABLE_OUTPUT;
|
||||
- ENSURE_( ioctl( stream->capture->fd, SNDCTL_DSP_SETTRIGGER, &enableBits ), paUnanticipatedHostError );
|
||||
+ size_t bufSz = PaOssStreamComponent_BufferSize( stream->capture );
|
||||
+ memset( stream->capture->buffer, 0, bufSz );
|
||||
+
|
||||
+ /* Looks like we have to turn off blocking before we try this, but if we don't fill the buffer
|
||||
+ * OSS will complain. */
|
||||
+ PA_ENSURE( ModifyBlocking( stream->capture->fd, 0 ) );
|
||||
+ while (1)
|
||||
+ {
|
||||
+ if( read( stream->capture->fd, stream->capture->buffer, bufSz ) < 0 )
|
||||
+ break;
|
||||
+ }
|
||||
+ PA_ENSURE( ModifyBlocking( stream->capture->fd, 1 ) );
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- if( stream->capture )
|
||||
- {
|
||||
- enableBits = PCM_ENABLE_INPUT;
|
||||
- ENSURE_( ioctl( stream->capture->fd, SNDCTL_DSP_SETTRIGGER, &enableBits ), paUnanticipatedHostError );
|
||||
- }
|
||||
- if( stream->playback )
|
||||
- {
|
||||
- enableBits = PCM_ENABLE_OUTPUT;
|
||||
- ENSURE_( ioctl( stream->playback->fd, SNDCTL_DSP_SETTRIGGER, &enableBits ), paUnanticipatedHostError );
|
||||
- }
|
||||
- }
|
||||
|
||||
/* Ok, we have triggered the stream */
|
||||
stream->triggered = 1;
|
||||
@@ -1612,7 +1610,11 @@ static void *PaOSS_AudioThreadProc( void *userData )
|
||||
if ( stream->capture )
|
||||
{
|
||||
PA_ENSURE( PaOssStreamComponent_Read( stream->capture, &frames ) );
|
||||
- assert( frames == framesAvail );
|
||||
+ if( frames < framesAvail )
|
||||
+ {
|
||||
+ PA_DEBUG(( "Read %lu less frames than requested\n", framesAvail - frames ));
|
||||
+ framesAvail = frames;
|
||||
+ }
|
||||
}
|
||||
|
||||
#if ( SOUND_VERSION >= 0x030904 )
|
||||
@@ -1648,9 +1650,11 @@ static void *PaOSS_AudioThreadProc( void *userData )
|
||||
frames = framesAvail;
|
||||
|
||||
PA_ENSURE( PaOssStreamComponent_Write( stream->playback, &frames ) );
|
||||
- assert( frames == framesAvail );
|
||||
-
|
||||
- /* TODO: handle bytesWritten != bytesRequested (slippage?) */
|
||||
+ if( frames < framesAvail )
|
||||
+ {
|
||||
+ /* TODO: handle bytesWritten != bytesRequested (slippage?) */
|
||||
+ PA_DEBUG(( "Wrote %lu less frames than requested\n", framesAvail - frames ));
|
||||
+ }
|
||||
}
|
||||
|
||||
framesAvail -= framesProcessed;
|
||||
@@ -1924,35 +1928,40 @@ static signed long GetStreamReadAvailable( PaStream* s
|
||||
/* TODO: Compute number of allocated bytes somewhere else, can we use ODELAY with capture */
|
||||
static signed long GetStreamWriteAvailable( PaStream* s )
|
||||
{
|
||||
- PaOssStream *stream = (PaOssStream*)s;
|
||||
- int delay = 0;
|
||||
+ PaOssStream *stream = (PaOssStream*)s;
|
||||
+ int delay = 0;
|
||||
+ u_long wseek;
|
||||
|
||||
- if( ioctl( stream->playback->fd, SNDCTL_DSP_GETODELAY, &delay ) < 0 )
|
||||
- return paUnanticipatedHostError;
|
||||
-
|
||||
- return (PaOssStreamComponent_BufferSize( stream->playback ) - delay) / PaOssStreamComponent_FrameSize( stream->playback );
|
||||
-}
|
||||
+ /* The OSS 4.x SNDCTL_DSP_GETODELAY ioctl doesn't exist on OpenBSD. */
|
||||
|
||||
-const char *PaOSS_GetInputDevice( PaStream* s )
|
||||
-{
|
||||
- PaOssStream *stream = (PaOssStream*)s;
|
||||
+ if ( ioctl( stream->playback->fd, AUDIO_WSEEK, &wseek) < 0 )
|
||||
+ return paUnanticipatedHostError;
|
||||
+ delay = (int)wseek;
|
||||
|
||||
- if( stream->capture )
|
||||
- {
|
||||
- return stream->capture->devName;
|
||||
- }
|
||||
-
|
||||
- return NULL;
|
||||
+ return (PaOssStreamComponent_BufferSize( stream->playback ) - delay)
|
||||
+ / PaOssStreamComponent_FrameSize( stream->playback );
|
||||
}
|
||||
|
||||
-const char *PaOSS_GetOutputDevice( PaStream* s )
|
||||
+int
|
||||
+trigger_output(int fd)
|
||||
{
|
||||
- PaOssStream *stream = (PaOssStream*)s;
|
||||
+ audio_info_t audio_if;
|
||||
+ if (ioctl(fd, AUDIO_GETINFO, &audio_if) == -1)
|
||||
+ return paUnanticipatedHostError;
|
||||
+ audio_if.play.pause = 0;
|
||||
+ if (ioctl(fd, AUDIO_SETINFO, &audio_if) == -1)
|
||||
+ return paUnanticipatedHostError;
|
||||
+ return paNoError;
|
||||
+}
|
||||
|
||||
- if( stream->playback )
|
||||
- {
|
||||
- return stream->playback->devName;
|
||||
- }
|
||||
-
|
||||
- return NULL;
|
||||
+int
|
||||
+trigger_input(int fd)
|
||||
+{
|
||||
+ audio_info_t audio_if;
|
||||
+ if (ioctl(fd, AUDIO_GETINFO, &audio_if) == -1)
|
||||
+ return paUnanticipatedHostError;
|
||||
+ audio_if.record.pause = 0;
|
||||
+ if (ioctl(fd, AUDIO_SETINFO, &audio_if) == -1)
|
||||
+ return paUnanticipatedHostError;
|
||||
+ return paNoError;
|
||||
}
|
Loading…
Reference in New Issue
Block a user