Subject: pkg/26601: fluidsynth package does not produce audio
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <gianni@stiletto.daprile.net>
List: pkgsrc-bugs
Date: 08/09/2004 00:46:02
>Number:         26601
>Category:       pkg
>Synopsis:       fluidsynth package does not produce audio
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 09 05:47:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Gianni D'Aprile
>Release:        NetBSD 2.0G
>Organization:
	
>Environment:
	
	
System: NetBSD stiletto.daprile.net 2.0G NetBSD 2.0G (STILETTO) #2: Sun Aug 8 12:13:29 CDT 2004 toor@stiletto.daprile.net:/usr/obj/usr/src/sys/arch/i386/compile/STILETTO i386
Architecture: i386
Machine: i386
>Description:
	The fluidsynth package does not work because oss thread creation is ifdef'd away on platform NetBSD.  NetBSD does not support pthread_attr_setschedpolicy, so the included patch-aa still works around that.
>How-To-Repeat:
	Build on platform NetBSD and try to use fluidsynth.
>Fix:
	Replace patch-aa with the included patch.


Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc-wip/wip/fluidsynth/distinfo,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 distinfo
--- distinfo	2 Aug 2004 04:43:47 -0000	1.1.1.1
+++ distinfo	9 Aug 2004 05:32:41 -0000
@@ -2,5 +2,5 @@
 
 SHA1 (fluidsynth-1.0.4.tar.gz) = db38a6df9728380dd2eda896c7456ab1ad9f3f1a
 Size (fluidsynth-1.0.4.tar.gz) = 942944 bytes
-SHA1 (patch-aa) = 13073b1d10939b4c8597c264e1ab15f54d72b684
+SHA1 (patch-aa) = 7780bf91846a6fb4767adc5dded2c3a943e57297
 SHA1 (patch-ab) = 8b9f615cf81bab81e0e6fc8f3e1c1a589b29cd90
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc-wip/wip/fluidsynth/patches/patch-aa,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-aa
--- patches/patch-aa	2 Aug 2004 04:43:47 -0000	1.1.1.1
+++ patches/patch-aa	9 Aug 2004 05:32:41 -0000
@@ -1,7 +1,5 @@
-$NetBSD$
-
---- src/fluid_oss.c.orig	Wed Mar  3 03:02:28 2004
-+++ src/fluid_oss.c
+--- src/fluid_oss.c.orig	2004-03-03 05:02:28.000000000 -0600
++++ src/fluid_oss.c	2004-08-09 00:19:14.000000000 -0500
 @@ -43,6 +43,12 @@
  #include <errno.h>
  #include <sys/poll.h>
@@ -15,7 +13,7 @@
  #define BUFFER_LENGTH 512
  
  /* SCHED_FIFO priorities for OSS threads (see pthread_attr_setschedparam) */
-@@ -103,7 +109,7 @@ static void* fluid_oss_midi_run(void* d)
+@@ -103,7 +109,7 @@
  void
  fluid_oss_audio_driver_settings(fluid_settings_t* settings)
  {
@@ -24,7 +22,7 @@
  }
  
  /*
-@@ -122,8 +128,10 @@ new_fluid_oss_audio_driver(fluid_setting
+@@ -122,8 +128,10 @@
    int format;
    pthread_attr_t attr;
    int err;
@@ -35,7 +33,7 @@
  
    dev = FLUID_NEW(fluid_oss_audio_driver_t);
    if (dev == NULL) {
-@@ -168,7 +176,7 @@ new_fluid_oss_audio_driver(fluid_setting
+@@ -168,7 +176,7 @@
    }
  
    if (!fluid_settings_getstr(settings, "audio.oss.device", &devname)) {
@@ -44,23 +42,29 @@
    }
  
    if (stat(devname, &devstat) == -1) {
-@@ -229,6 +237,7 @@ new_fluid_oss_audio_driver(fluid_setting
+@@ -229,6 +237,13 @@
      goto error_recovery;
    }
  
-+#if !defined(__NetBSD__)
++#ifdef __NetBSD__
++  err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run, (void*) dev);
++  if (err) {
++    FLUID_LOG(FLUID_ERR, "Couldn't create audio thread");
++    goto error_recovery;
++  }
++#else
    /* the pthread_create man page explains that
       pthread_attr_setschedpolicy returns an error if the user is not
       permitted the set SCHED_FIFO. it seems however that no error is
-@@ -264,6 +273,7 @@ new_fluid_oss_audio_driver(fluid_setting
+@@ -264,6 +279,7 @@
      }
      break;
    }
-+#endif /* !defined(__NetBSD__) */
++#endif /* __NetBSD__ */
  
    return (fluid_audio_driver_t*) dev;
  
-@@ -285,8 +295,10 @@ new_fluid_oss_audio_driver2(fluid_settin
+@@ -285,8 +301,10 @@
    int format;
    pthread_attr_t attr;
    int err;
@@ -71,7 +75,7 @@
  
    dev = FLUID_NEW(fluid_oss_audio_driver_t);
    if (dev == NULL) {
-@@ -311,7 +323,7 @@ new_fluid_oss_audio_driver2(fluid_settin
+@@ -311,7 +329,7 @@
  
  
    if (!fluid_settings_getstr(settings, "audio.oss.device", &devname)) {
@@ -80,23 +84,29 @@
    }
    if (stat(devname, &devstat) == -1) {
      FLUID_LOG(FLUID_ERR, "Device <%s> does not exists", devname);    
-@@ -380,6 +392,7 @@ new_fluid_oss_audio_driver2(fluid_settin
+@@ -380,6 +398,13 @@
      goto error_recovery;
    }
  
-+#if !defined(__NetBSD__)
++#ifdef __NetBSD__
++  err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run2, (void*) dev);
++  if (err) {
++    FLUID_LOG(FLUID_ERR, "Couldn't create audio2 thread");
++    goto error_recovery;
++  }
++#else
    /* the pthread_create man page explains that
       pthread_attr_setschedpolicy returns an error if the user is not
       permitted the set SCHED_FIFO. it seems however that no error is
-@@ -415,6 +428,7 @@ new_fluid_oss_audio_driver2(fluid_settin
+@@ -415,6 +440,7 @@
      }
      break;
    }
-+#endif /* !defined(__NetBSD__) */
++#endif /* __NetBSD__ */
  
    return (fluid_audio_driver_t*) dev;
  
-@@ -644,7 +658,7 @@ fluid_oss_audio_run2(void* d)
+@@ -644,7 +670,7 @@
  
  void fluid_oss_midi_driver_settings(fluid_settings_t* settings)
  {
@@ -105,7 +115,7 @@
  }
  
  /*
-@@ -657,8 +671,10 @@ new_fluid_oss_midi_driver(fluid_settings
+@@ -657,8 +683,10 @@
    int err;
    fluid_oss_midi_driver_t* dev;
    pthread_attr_t attr;
@@ -116,7 +126,7 @@
    char* device;
    
    /* not much use doing anything */
-@@ -689,7 +705,7 @@ new_fluid_oss_midi_driver(fluid_settings
+@@ -689,7 +717,7 @@
    /* get the device name. if none is specified, use the default device. */
    fluid_settings_getstr(settings, "midi.oss.device", &device);
    if (device == NULL) {
@@ -125,20 +135,26 @@
    }
  
    /* open the default hardware device. only use midi in. */
-@@ -706,6 +722,8 @@ new_fluid_oss_midi_driver(fluid_settings
+@@ -706,6 +734,14 @@
      FLUID_LOG(FLUID_ERR, "Couldn't initialize midi thread attributes");
      goto error_recovery;
    }
 +
-+#if !defined(__NetBSD__)
++#ifdef __NetBSD__
++  err = pthread_create(&dev->thread, &attr, fluid_oss_midi_run, (void*) dev);
++  if (err) {
++    FLUID_LOG(FLUID_ERR, "Couldn't create midi thread");
++    goto error_recovery;
++  }
++#else
    /* use fifo scheduling. if it fails, use default scheduling. */
    while (1) {
      err = pthread_attr_setschedpolicy(&attr, sched);
-@@ -737,6 +755,7 @@ new_fluid_oss_midi_driver(fluid_settings
+@@ -737,6 +773,7 @@
      }
      break;
    }  
-+#endif /* !defined(__NetBSD__) */
++#endif /* __NetBSD__ */
    return (fluid_midi_driver_t*) dev;
  
   error_recovery:
	
>Release-Note:
>Audit-Trail:
>Unformatted: