Not sure how I managed that one, so I've reattached it. Alternatively,
you can run:

svn diff -r1870:1871 > mixxx_alsarealtime.patch 

Albert

On Mon, 2008-03-03 at 17:42 -0500, Garth Dahlstrom wrote:
> Ditto, nothing there.
> 
> On Mon, Mar 3, 2008 at 5:33 PM, Adam Davison <[EMAIL PROTECTED]>
> wrote:
>         When i tried to open the attached patch, it was 0k and had
>         nothing in
>         it. Or is that just me?
>         
>         
>         On 03/03/2008, Albert Santoni <[EMAIL PROTECTED]> wrote:
>         > Hi guys,
>         >
>         >  I've just committed some code to SVN that tries to
>         dynamically resolve
>         >  this extension in PortAudio that lets us request a realtime
>         priority
>         >  callback when using ALSA. That means you don't need to
>         patch PortAudio
>         >  to take advantage of this, and all users running an RT
>         kernel should
>         >  experience a nice performance boost with latest SVN.
>         >
>         >  If anyone's interested in how I did this, take a look at
>         the patch
>         >  attached.
>         >
>         >  Enjoy,
>         >
>         > Albert
>         >
>         
>         >
>         
> -------------------------------------------------------------------------
>         >  This SF.net email is sponsored by: Microsoft
>         >  Defy all challenges. Microsoft(R) Visual Studio 2008.
>         >  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>         > _______________________________________________
>         >  Mixxx-devel mailing list
>         >  [email protected]
>         >  https://lists.sourceforge.net/lists/listinfo/mixxx-devel
>         >
>         >
>         >
>         
>         
> -------------------------------------------------------------------------
>         This SF.net email is sponsored by: Microsoft
>         Defy all challenges. Microsoft(R) Visual Studio 2008.
>         http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>         _______________________________________________
>         Mixxx-devel mailing list
>         [email protected]
>         https://lists.sourceforge.net/lists/listinfo/mixxx-devel
> 
> 
> 
> -- 
>               __
> --- == __/ t.O ==--
> http://stacktrace.org/
Index: src/sounddeviceportaudio.cpp
===================================================================
--- src/sounddeviceportaudio.cpp	(revision 1870)
+++ src/sounddeviceportaudio.cpp	(revision 1871)
@@ -40,7 +40,6 @@
     m_iNumberOfBuffers = 2;
     m_iNumInputChannels = m_deviceInfo->maxInputChannels;
     m_iNumOutputChannels = m_deviceInfo->maxOutputChannels;
-
 }
 
 SoundDevicePortAudio::~SoundDevicePortAudio()
@@ -195,6 +194,20 @@
         qDebug() << "Opened PortAudio stream successfully... starting";
     }
 
+    //Attempt to dynamically load and resolve stuff in the PortAudio library
+    QLibrary portaudio("libportaudio.so.2");
+    if (!portaudio.load())
+       qDebug() << "Failed to dynamically load PortAudio library";
+    else
+       qDebug() << "Dynamically load PortAudio library!";        
+    
+    EnableAlsaRT enableRealtime = (EnableAlsaRT) portaudio.resolve("PaAlsa_EnableRealtimeScheduling");
+    if (rt)
+    {
+        enableRealtime(m_pStream, 1);
+    }
+    portaudio.unload();
+
     // Start stream
     err = Pa_StartStream(m_pStream);
     if (err != paNoError)
Index: src/sounddeviceportaudio.h
===================================================================
--- src/sounddeviceportaudio.h	(revision 1870)
+++ src/sounddeviceportaudio.h	(revision 1871)
@@ -28,6 +28,11 @@
   * when setting latency */
 #define MIXXXPA_MAX_FRAME_SIZE 1024
 
+/** Dynamically resolved function which allows us to enable a realtime-priority callback
+    thread from ALSA/PortAudio. This must be dynamically resolved because PortAudio can't
+    tell us if ALSA is compiled into it or not. */
+typedef int (*EnableAlsaRT)(PaStream* s, int enable);
+
 class SoundDevicePortAudio;
 
 /** A struct to some stuff we need to pass along to the callback through PortAudio **/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to