[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NEW : audacity



On Mon, Jan 10, 2005 at 08:06:34PM -0500, Ian Darwin wrote:
> 
> >Tested on macppc. Works nicely with one exception: the File->Open 
> >dialog box shows only directory  icons, no file icons and no names 
> >beside the icons.  Makes it a bit tricky to navigate. Screen shot at
> >
> Oh dear. There is another problem. When you try to record, it locks up 
> the program hard, requiring you to kill it from another window. It's not
> in a CPU loop, though:

> 10037 ian        2    0 8084K   16M sleep    poll     0:04  0.00% audacity

it never explicitly sets a play or record mode.

attached are some hacks. full-duplex doesn't work for me (does anyone
have any example of working full-duplex code?), but record and play
do work.

it would probably be a good idea to rename the patches to be like
'make update-patches'.

-- 
<jakemsr_(_at_)_jakemsr_(_dot_)_com>
--- lib-src/portaudio/pa_unix_oss/pa_unix.c.orig	Wed Nov 17 22:17:34 2004
+++ lib-src/portaudio/pa_unix_oss/pa_unix.c	Mon Jan 10 22:29:52 2005
@@ -399,6 +399,7 @@ static int PaHost_CanaryProc( PaHostSoun
     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( int
 
     return result;
 }
+#endif  /* Watchdog */
 
 /*******************************************************************************************/
 static PaError Pa_AudioThreadProc( internalPortAudioStream   *past )
@@ -613,8 +615,10 @@ static PaError Pa_AudioThreadProc( inter
     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( inter
     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( internalPortA
                            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
--- lib-src/portaudio/pa_unix_oss/pa_unix_oss.c.orig	Wed Nov 17 22:17:34 2004
+++ lib-src/portaudio/pa_unix_oss/pa_unix_oss.c	Mon Jan 10 22:29:25 2005
@@ -43,7 +43,8 @@
 #ifdef __linux__
 #include <linux/soundcard.h>
 #else
-#include <machine/soundcard.h> /* JH20010905 */
+#include <soundcard.h> /* JH20010905 */
+#include <sys/audioio.h>
 #endif
 
 
@@ -217,11 +218,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;
@@ -271,18 +276,56 @@ PaError Pa_SetupDeviceFormat( int devHan
            return paHostError;
         }
     }
-    
+
+#ifdef __OpenBSD__
+
+    AUDIO_INITINFO(&audio_if);
+
+    switch(input) {
+    case 2:
+        fprintf(stderr, "Setting to full-duplex mode for OpenBSD\n");
+        audio_if.record.open = 1;
+        audio_if.record.pause = 0;
+        audio_if.play.open = 1;
+        audio_if.play.pause = 0;
+        break;
+
+    case 1:
+        fprintf(stderr, "Setting to record mode for OpenBSD\n");
+        audio_if.record.open = 1;
+        audio_if.record.pause = 0;
+        break;
+
+    case 0:
+        fprintf(stderr, "Setting to play mode for OpenBSD\n");
+        audio_if.play.open = 1;
+        audio_if.play.pause = 0;
+        break;
+
+    default:
+       fprintf(stderr, "Unknown mode for OpenBSD\n");
+       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);
 }
 
 

Visit your host, monkey.org