On Thu, Jul 26, 2007 at 04:08:57AM +0200, Gareth wrote:
> recently I updated my main desktop to -current (base and packages) from
> -release (via snapshots) and I noticed problem with esound 0.2.38 (which I
> need to use XMMS since my audio device is auich(4), only supporting 48khz
> output) where it scratches and stutters a whole lot making most audio
> unbearable.  I was wondering if anyone else has had similar problems? 
> Also, esound 0.2.38 doesn't appear to read /etc/esd.conf any longer
> (reading only ~/.esd.conf).  I managed in a fully-unsupported and hackish
> way to get back to 0.2.34 and it works fine so it isn't the hardware or
> (as I initially thought) the changes to the kernel audio code recently. 
> I'm wondering if this is an esound problem (since they presumably don't
> test too much on auich with bsd/sun audio over there) or an
> openbsd-specific problem.   Open to suggestions to fix this in a better
> way.


this is at least the second report of problems with esound.

http://marc.info/?l=openbsd-ports&m=118405592003119&w=2

both these reports pretty much peg esound as the problem.

unfortunately, we have audio devices that only support 48kHz sampling
rate, and such audio daemons are a necessary evil to be able to play
CDs and the release songs correctly.

is this still a problem?  anyone else having problems?

I looked over esound, and the following patch is all I can see that
could even remotely be a problem with the audio interface.

esound uses blocking writes.  none of the changes I have made to
audio affect blocking writes.  if they did, almost every audio program
would show symptoms.

-- 
[EMAIL PROTECTED]
SDF Public Access UNIX System - http://sdf.lonestar.org


- open() never blocks
- set the blocksize to the size of data chunks we will receive.
  not necessary, but nicer.


Index: Makefile
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/esound/Makefile,v
retrieving revision 1.40
diff -u -r1.40 Makefile
--- Makefile    26 Jun 2007 17:10:29 -0000      1.40
+++ Makefile    2 Aug 2007 19:42:08 -0000
@@ -4,6 +4,7 @@
 COMMENT=       "sound library for Enlightenment"
 
 DISTNAME=      esound-0.2.38
+PKGNAME=       ${DISTNAME}p0
 SHARED_LIBS += esd                  2.38     # .2.38
 CATEGORIES=    audio
 MASTER_SITES=  ${MASTER_SITE_GNOME:=sources/esound/0.2/}
Index: files/audio_sun.c
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/esound/files/audio_sun.c,v
retrieving revision 1.3
diff -u -r1.3 audio_sun.c
--- files/audio_sun.c   25 Jan 2004 22:07:28 -0000      1.3
+++ files/audio_sun.c   2 Aug 2007 19:42:08 -0000
@@ -63,8 +63,6 @@
        info.mode = AUMODE_PLAY;
     }
 
-    mode |= O_NONBLOCK;
-
     /* open the sound device */
     device = esd_audio_device ? esd_audio_device : "/dev/audio";
     if ((afd = open(device, mode, 0)) == -1) {
@@ -72,10 +70,6 @@
         return( -2 );
     }
 
-    mode = fcntl(afd, F_GETFL);
-    mode &= ~O_NONBLOCK;
-    fcntl(afd, F_SETFL, mode);
-
     /* set the requested mode */
     if(ioctl(afd, AUDIO_SETINFO, &info) < 0) {
        sun_panic(afd, "AUDIO_SETINFO");
@@ -132,6 +126,20 @@
     if(ioctl(afd, AUDIO_SETINFO, &info) < 0 || 
        fabs(info.play.sample_rate - esd_audio_rate) > esd_audio_rate * 0.05) {
        fprintf(stderr, "Unsupported rate: %i Hz\n", esd_audio_rate);
+       sun_panic(afd, "SETINFO");
+       return(-1);
+    }
+
+    /* OSS interface sets the blocksize to 256 bytes, but esound
+     * actually uses 8192 byte blocks for 16-bit encodings and 4096
+     * byte blocks for 8-bit encodings.
+     */
+    if (enc.precision == 16)
+        info.blocksize = 8192;
+    else
+        info.blocksize = 4096;
+    if(ioctl(afd, AUDIO_SETINFO, &info) == -1) {
+       fprintf(stderr, "Unsupported blocksize: %d\n", info.blocksize);
        sun_panic(afd, "SETINFO");
        return(-1);
     }

Reply via email to