[speex-dev] Sun audio driver for speexdec

Christian Weisgerber naddy at mips.inka.de
Wed Jun 11 17:44:18 PDT 2003



I did this for OpenBSD.  NetBSD uses the same audio(4) system.
It should also work on Solaris, but I can't test that.

--- configure.in.orig	Tue May 13 00:58:07 2003
+++ configure.in	Tue May 13 00:58:20 2003
@@ -26,7 +26,7 @@ AC_CANONICAL_HOST
 AM_PROG_LIBTOOL
 
 AC_C_BIGENDIAN
-AC_CHECK_HEADERS(sys/soundcard.h)
+AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
 
 AC_ARG_ENABLE(ogg,
       [  --enable-ogg=[yes/no]    Turn on or off the use of ogg
--- src/speexdec.c.orig	Thu Jun 12 01:11:28 2003
+++ src/speexdec.c	Thu Jun 12 01:14:31 2003
@@ -56,6 +56,14 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
+#elif defined HAVE_SYS_AUDIOIO_H
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/audioio.h>
+#include <fcntl.h>
+#ifndef AUDIO_ENCODING_SLINEAR
+#define AUDIO_ENCODING_SLINEAR AUDIO_ENCODING_LINEAR	/* Solaris */
+#endif
 #endif
 
 #include <string.h>
@@ -166,6 +174,32 @@ FILE *out_file_open(char *outFile, int r
          close(audio_fd);
          exit(1);
       }
+      fout = fdopen(audio_fd, "w");
+#elif defined HAVE_SYS_AUDIOIO_H
+      audio_info_t info;
+      int audio_fd;
+ 
+      audio_fd = open("/dev/audio", O_WRONLY);
+      if (audio_fd<0)
+      {
+         perror("Cannot open /dev/audio");
+         exit(1);
+      }
+
+      AUDIO_INITINFO(&info);
+#ifdef AUMODE_PLAY	/* NetBSD/OpenBSD */
+      info.mode = AUMODE_PLAY;
+#endif
+      info.play.encoding = AUDIO_ENCODING_SLINEAR;
+      info.play.precision = 16;
+      info.play.sample_rate = rate;
+      info.play.channels = *channels;
+
+      if (ioctl(audio_fd, AUDIO_SETINFO, &info) < 0)
+      {
+         perror("AUDIO_SETINFO");
+         exit(1);
+      } 
       fout = fdopen(audio_fd, "w");
 #elif defined WIN32 || defined _WIN32
       {

-- 
Christian "naddy" Weisgerber                          naddy at mips.inka.de
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Speex-dev mailing list