rpms/olpcsound/OLPC-3 jack-pulseaudio.patch, NONE, 1.1 rtalsa-sched.patch, NONE, 1.1 olpcsound.spec, 1.8, 1.9

Victor Lazzarini (veplaini) fedora-extras-commits at redhat.com
Fri Aug 15 13:01:06 UTC 2008


Author: veplaini

Update of /cvs/pkgs/rpms/olpcsound/OLPC-3
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24094

Modified Files:
	olpcsound.spec 
Added Files:
	jack-pulseaudio.patch rtalsa-sched.patch 
Log Message:
olpcsound.spec

jack-pulseaudio.patch:

--- NEW FILE jack-pulseaudio.patch ---
Patch to include jack and pulseaudio in the
csound build (scons buildOLPC=1)

Index: olpcsound-5.08.92/SConstruct
===========================================================================
--- SConstruct.old
+++ SConstruct	
@@ -339,8 +339,8 @@ if commonEnvironment['buildOLPC'] == '1'
     commonEnvironment['useGettext'] = '1'
     commonEnvironment['useDouble'] = '0'
     commonEnvironment['usePortAudio'] = '0'
-    commonEnvironment['useJack'] = '0'
-    jackFound = False
+    commonEnvironment['useJack'] = '1'
+    #jackFound = False
     commonEnvironment['buildCsoundAC'] = '0'
     commonEnvironment['buildCsound5GUI'] = '0'
     commonEnvironment['useDouble'] = '0'
@@ -639,12 +639,12 @@ boostFound = configure.CheckHeader("boos
 gmmFound = configure.CheckHeader("gmm/gmm.h", language = "C++")
 alsaFound = configure.CheckLibWithHeader("asound", "alsa/asoundlib.h", language = "C")
 oscFound = configure.CheckLibWithHeader("lo", "lo/lo.h", language = "C")
-if not buildOLPC:
-    jackFound = configure.CheckLibWithHeader("jack", "jack/jack.h", language = "C")
-if not buildOLPC:
- pulseaudioFound = configure.CheckHeader("pulse/simple.h", language = "C")
-else:
- pulseaudioFound = 0
+#if not buildOLPC:
+jackFound = configure.CheckLibWithHeader("jack", "jack/jack.h", language = "C")
+#if not buildOLPC:
+pulseaudioFound = configure.CheckHeader("pulse/simple.h", language = "C")
+#else:
+#pulseaudioFound = 0
 stkFound = configure.CheckHeader("Opcodes/stk/include/Stk.h", language = "C++")
 pdhfound = configure.CheckHeader("m_pd.h", language = "C")
 tclhfound = configure.CheckHeader("tcl.h", language = "C")
@@ -1480,7 +1480,7 @@ makePlugin(pluginEnvironment, 'gabnew', 
     Opcodes/gab/newgabopc.c
 '''))
 makePlugin(pluginEnvironment, 'hrtfnew', 'Opcodes/hrtfopcodes.c')
-if (not buildOLPC) and jackFound:
+if jackFound:
     makePlugin(pluginEnvironment, 'jackTransport', 'Opcodes/jackTransport.c')
 if (not buildOLPC) and boostFound:
     makePlugin(pluginEnvironment, 'chua', 'Opcodes/chua/ChuaOscillator.cpp')

rtalsa-sched.patch:

--- NEW FILE rtalsa-sched.patch ---
Patch to add scheduler priority setting to alsa module

Index: olpcsound-5.08.92/InOut/rtalsa.c
==============================================================
--- olpcsound-5.08.92/InOut/rtalsa.c.old
+++ olpcsound-5.08.92/InOut/rtalsa.c
@@ -46,6 +46,12 @@
 #include <termios.h>
 #include <errno.h>
 #include <alsa/asoundlib.h>
+#include <sched.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <sys/resource.h>
+
 
 #include "soundio.h"
 
@@ -89,6 +95,40 @@ static const unsigned char dataBytes[16]
     0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2, 0
 };
 
+
+
+int set_scheduler_priority(CSOUND *csound, int priority)
+{
+    struct sched_param p;
+ 
+    memset(&p, 0, sizeof(struct sched_param));
+    if (priority < -20 || priority > sched_get_priority_max(SCHED_RR)) {
+      csound->Message(csound, "--scheduler: invalid priority value; the allowed range is:");
+      csound->Message(csound,"  -20 to -1: set nice level");
+      csound->Message(csound,"          0: normal scheduling, but lock memory");
+      csound->Message(csound,"    1 to %d: SCHED_RR with the specified priority "
+                    "(DANGEROUS)", sched_get_priority_max(SCHED_RR));
+            return -1;
+       }
+    /* set scheduling policy and priority */
+    if (priority > 0) {
+      p.sched_priority = priority;
+      if (sched_setscheduler(0, SCHED_RR, &p) != 0) {
+        csound->Message(csound,"csound: cannot set scheduling policy to SCHED_RR");
+      }
+      else   csound->Message(csound,"csound: setting scheduling policy to SCHED_RR\n");
+    }
+    else {
+      /* nice requested */
+      if (setpriority(PRIO_PROCESS, 0, priority) != 0) {
+        csound->Message(csound,"csound: cannot set nice level to %d",
+                       priority);
+      }
+    }
+    return 0;
+}
+
+
 /* sample conversion routines for playback */
 
 static void MYFLT_to_short(int nSmps, MYFLT *inBuf, int16_t *outBuf, int *seed)
@@ -462,6 +502,7 @@ static int rtrecord_(CSOUND *csound, MYF
 {
     DEVPARAMS *dev;
     int       n, m, err;
+   
 
     dev = (DEVPARAMS*) csound->rtRecord_userdata;
     if (dev->handle == NULL) {
@@ -508,7 +549,7 @@ static void rtplay_(CSOUND *csound, cons
 {
     DEVPARAMS *dev;
     int     n, err;
-
+    
     dev = (DEVPARAMS*) csound->rtPlay_userdata;
     if (dev->handle == NULL)
       return;
@@ -893,14 +934,29 @@ static int midi_out_close_file(CSOUND *c
     return retval;
 }
 
+
+
+
 /* module interface functions */
 
 PUBLIC int csoundModuleCreate(CSOUND *csound)
 {
+
+    int minsched, maxsched, *priority;
+    csound->CreateGlobalVariable(csound, "::priority", sizeof(int));
+    priority = (int *) (csound->QueryGlobalVariable(csound, "::priority"));
+    if (priority == NULL)
+      csound->Message(csound, "warning... could not create global var\n");
+    minsched = -20;
+    maxsched = (int) sched_get_priority_max(SCHED_RR); 
+    csound->CreateConfigurationVariable(csound, "rtscheduler", priority, CSOUNDCFG_INTEGER, 0, &minsched, &maxsched,                      
+                   "RT scheduler priority, alsa module", NULL);
+
     /* nothing to do, report success */
     if (csound->oparms->msglevel & 0x400)
       csound->Message(csound, "ALSA real-time audio and MIDI module "
                       "for Csound by Istvan Varga\n");
+
     return 0;
 }
 
@@ -911,6 +967,16 @@ PUBLIC int csoundModuleInit(CSOUND *csou
     int     i;
     char    buf[9];
 
+    csCfgVariable_t *cfg;
+    int priority;
+    cfg = csound->QueryConfigurationVariable(csound, "rtscheduler");
+    priority = *(cfg->i.p);  
+
+    if(priority != 0) set_scheduler_priority(csound, priority);
+  
+    csound->DeleteConfigurationVariable(csound, "rtscheduler");
+    csound->DestroyGlobalVariable(csound, "::priority");
+
     s = (char*) csound->QueryGlobalVariable(csound, "_RTAUDIO");
     i = 0;
     if (s != NULL) {


Index: olpcsound.spec
===================================================================
RCS file: /cvs/pkgs/rpms/olpcsound/OLPC-3/olpcsound.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- olpcsound.spec	11 Aug 2008 21:43:48 -0000	1.8
+++ olpcsound.spec	15 Aug 2008 13:00:36 -0000	1.9
@@ -1,7 +1,7 @@
 Summary: Csound - sound synthesis language and library, OLPC subset
 Name:   olpcsound        
 Version: 5.08.92
-Release: 8%{?dist}
+Release: 9%{?dist}
 URL: http://csound.sourceforge.net/
 License: LGPLv2+
 Group: Applications/Multimedia
@@ -10,8 +10,11 @@
 Patch1: ogg-opcode-fix.patch
 Patch2: libstdutil-fix.patch
 Patch3: sfont-envelope.patch
+Patch4: jack-pulseaudio.patch
+Patch5: rtalsa-sched.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: swig python scons alsa-lib-devel liblo-devel libsndfile-devel 
+BuildRequires: jack-connection-kit-devel pulseaudio-devel
 BuildRequires: libpng-devel libjpeg-devel libvorbis-devel libogg-devel gettext python-devel
 %define python_site_dir %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
 
@@ -33,6 +36,8 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
+%patch5 -p1
 
 %build
 %{_bindir}/scons buildOLPC=1 customCCFLAGS="%{optflags}" customCXXFLAGS="%{optflags}"
@@ -71,6 +76,10 @@
 
 
 %changelog
+* Fri Aug 15 2008 Victor Lazzarini <vlazzarini at nuim.ie> - 5.08.92-9
+  - add patches for including jack and pulseaudio modules on the build,
+    and rt scheduler priority setting code to alsa module
+
 * Mon Aug 11 2008 Victor Lazzarini <vlazzarini at nuim.ie> - 5.08.92-8
   - add patch for amplitude envelopes on soundfont opcodes
 




More information about the fedora-extras-commits mailing list