On Sat, Feb 02, 2008 at 03:53:45PM +0100, Jonathan Schleifer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
> 
> "Federico G. Schwindt" <[EMAIL PROTECTED]> wrote:
> 
> >   yes, same thing here. i was expected it was due to my card or
> > something. iirc, the previous version has oss by default, need to
> > look into it.
> 
> The sun plugin is unmaintained atm AFAIK, therefore you should keep the
> OSS plugin as default. I personally verify from time to time that it
> works well on OpenBSD (I'm one of the devs) :)
> Even in the past, where the sun plugin worked, the OSS plugin was
> working better on OpenBSD, anyway.

hmm, yep, there are some problems with the sun output plugin.

patch below against in-tree port fixes some of them, but there is
still a problem with format conversions.  I'll have a patch for that
later.  also, distributing a system header is a bad idea, IMNSHO.

I'd rather not rely on OSS, especially in cases where there is already
mostly working native code.  I doubt we'll go out of our way to support
OSSv4 anytime soon (and likely never really support OSSv4 mixer API).

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

$OpenBSD$
--- src/sun/audio.c.orig        Sat Feb  2 14:35:35 2008
+++ src/sun/audio.c     Sat Feb  2 14:38:03 2008
@@ -130,7 +130,6 @@ static void sun_setformat(AFormat fmt, int rate, int n
        effect.bps = sun_bps(sun, rate, nch);
 
        output.format.sun = sun;
-       output.format.xmms = fmt;
        output.frequency = rate;
        output.channels = nch;
        sun_setparams();
@@ -150,7 +149,7 @@ void sun_setparams(void)
 
        AUDIO_INITINFO(&info);
 
-       info.mode = AUMODE_PLAY;
+       info.mode = AUMODE_PLAY_ALL;
        if (ioctl(audio.fd, AUDIO_SETINFO, &info) != 0)
        {
                g_error("%s: cannot play (%s)", audio.devaudio,
@@ -188,14 +187,11 @@ void sun_setparams(void)
        }
 
        if (ioctl(audio.fd, AUDIO_GETINFO, &info) != 0)
-       {
                blocksize = SUN_DEFAULT_BLOCKSIZE;
-               output.channels = info.play.channels;
-       }
        else
-       {
-               blocksize = blocksize;
-       }
+               blocksize = info.blocksize;
+       output.channels = info.play.channels;
+       output.frequency = info.play.sample_rate;
 
        sun_convert = sun_get_convert_func(output.format.sun,
                                           sun_format(effect.format.xmms));
@@ -210,12 +206,12 @@ void sun_setparams(void)
 
 static inline void sun_bufused(void)
 {
-       audio_offset_t ooffs;
+       u_long ofs;
 
        if (audio.paused)
                device_buffer_used = 0;
-       else if (ioctl(audio.fd, AUDIO_GETOOFFS, &ooffs) == 0)
-               device_buffer_used = ooffs.offset;
+       else if (ioctl(audio.fd, AUDIO_WSEEK, &ofs) == 0)
+               device_buffer_used = ofs;
 }
 
 int sun_written_time(void)
@@ -293,7 +289,7 @@ static inline ssize_t write_all(int fd, const void *bu
        {
                static ssize_t n;
 
-               n = write(fd, buf, count - done);
+               n = write(fd, buf + done, count - done);
                if (n == -1)
                {
                        if (errno == EINTR)
@@ -311,6 +307,7 @@ static inline void sun_write_audio(gpointer data, int 
 {
        AFormat new_format;
        EffectPlugin *ep;
+       struct audio_bufinfo buf_info;
        int new_frequency, new_channels;
 
        new_format = input.format.xmms;
@@ -337,6 +334,14 @@ static inline void sun_write_audio(gpointer data, int 
                                         input.frequency, input.channels);
        }
 
+       if (realtime && !ioctl(audio.fd, AUDIO_GETPRINFO, &buf_info)) {
+               while ((buf_info.hiwat * buf_info.blksize - buf_info.seek) < 
length) {
+                       xmms_usleep(10000);
+                       if (ioctl(audio.fd, AUDIO_GETPRINFO, &buf_info))
+                               break;
+               }
+       }
+
        if (sun_convert != NULL)
                length = sun_convert(&data, length);
 
@@ -448,7 +453,7 @@ void sun_flush(int time)
        ioctl(audio.fd, AUDIO_FLUSH, NULL);
 
        output_time_offset = time;
-       written = (guint16)(time / 10) * (guint64)(input.bps / 100);
+       written = ((guint64) time * input.bps) / 1000;
        output_bytes = 0;
 }
 
$OpenBSD$
--- src/sun/sun.h.orig  Sat Feb  2 14:35:27 2008
+++ src/sun/sun.h       Sat Feb  2 14:35:46 2008
@@ -33,7 +33,7 @@
 #include <string.h>
 #include <pthread.h>
 
-#include "audioio.h"
+#include <sys/audioio.h>
 
 #include "audacious/plugin.h"
 #include "audacious/configdb.h"

Reply via email to