summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorblymn <blymn>2000-06-18 11:11:51 +0000
committerblymn <blymn>2000-06-18 11:11:51 +0000
commit59fd929d60a190e911587519b6a811cb42e0a2d7 (patch)
tree829892dcba3563a11d9620d12ff68cdc144a019b /audio
parent582a4a18e1ba3903124d6b442d9afe9f94e61b1a (diff)
downloadpkgsrc-59fd929d60a190e911587519b6a811cb42e0a2d7.tar.gz
* Changed the way xamp supports NetBSD, we now have our own audioIO file.
* Added support for 8bit sound cards (it sounds crappy but when it is all you have....) * Fixed bug in debug mode code.
Diffstat (limited to 'audio')
-rw-r--r--audio/xamp/files/patch-sum12
-rw-r--r--audio/xamp/patches/patch-aa29
-rw-r--r--audio/xamp/patches/patch-af32
-rw-r--r--audio/xamp/patches/patch-ag230
-rw-r--r--audio/xamp/patches/patch-aj33
-rw-r--r--audio/xamp/patches/patch-ak30
-rw-r--r--audio/xamp/patches/patch-al24
-rw-r--r--audio/xamp/patches/patch-am24
8 files changed, 359 insertions, 55 deletions
diff --git a/audio/xamp/files/patch-sum b/audio/xamp/files/patch-sum
index 9ace978bca2..b8eb4e7e367 100644
--- a/audio/xamp/files/patch-sum
+++ b/audio/xamp/files/patch-sum
@@ -1,11 +1,15 @@
-$NetBSD: patch-sum,v 1.3 2000/03/28 00:09:21 dmcmahill Exp $
+$NetBSD: patch-sum,v 1.4 2000/06/18 11:11:51 blymn Exp $
-MD5 (patch-aa) = 01e268f9ad2bf936744ad1acc50175d2
+MD5 (patch-aa) = 2d2d115b0bfd5381dfde41380d519273
MD5 (patch-ab) = 6c6eca722a46d0151c1b2392945e1136
MD5 (patch-ac) = e4c19506ef2163d2b1ac239d300b44b6
MD5 (patch-ad) = 4b477706bbaf6ecd6218ef94279de0de
MD5 (patch-ae) = 22bc923503d26fe3b2634323907ddb8f
-MD5 (patch-af) = bf81124d051be2e04ff6be01c1f71e13
-MD5 (patch-ag) = 825e22e159d0c3ea81833489c8598758
+MD5 (patch-af) = 0ccf8089e05a28ea47d67a7723e499a9
+MD5 (patch-ag) = a6f6afb4a16a59dc2fea35740a41da42
MD5 (patch-ah) = 10ca40d39c0a1f868516a0374a469d8f
MD5 (patch-ai) = 88ab8bd5ed85ac6378b2bb9cdc0d0d9e
+MD5 (patch-aj) = a7a54229fe57fa14b0d2289c05da664a
+MD5 (patch-ak) = 1ce14f1d2305615532f0880ba226ff02
+MD5 (patch-al) = 9c21eed119558a3e602cc023f6e5797a
+MD5 (patch-am) = af88822bffc737d9ed7d9fcd4c304191
diff --git a/audio/xamp/patches/patch-aa b/audio/xamp/patches/patch-aa
index 6b5082acff5..1fbdfbb5f0e 100644
--- a/audio/xamp/patches/patch-aa
+++ b/audio/xamp/patches/patch-aa
@@ -1,13 +1,16 @@
-$NetBSD: patch-aa,v 1.2 1999/11/15 13:07:12 rh Exp $
-
---- ../audioIO.c.orig Sat May 31 19:47:58 1997
-+++ ../audioIO.c Mon Nov 15 13:58:45 1999
-@@ -18,7 +18,7 @@
- #include "audioIO_HPUX.c"
- #endif
-
--#ifdef OS_SunOS
-+#if defined(OS_SunOS) || defined(OS_NetBSD)
- #include "audioIO_SunOS.c"
- #endif
-
+diff -c ../audioIO.c:1.1.1.1 xamp/audioIO.c:1.2
+*** ../audioIO.c:1.1.1.1 Wed Jun 14 22:23:48 2000
+--- ../audioIO.c Wed Jun 14 22:23:48 2000
+***************
+*** 6,11 ****
+--- 6,15 ----
+ #include "audioIO_Linux.c"
+ #endif
+
++ #ifdef OS_NetBSD
++ #include "audioIO_NetBSD.c"
++ #endif
++
+ #ifdef OS_BSD
+ #include "audioIO_Linux.c"
+ #endif
diff --git a/audio/xamp/patches/patch-af b/audio/xamp/patches/patch-af
index b10f4e184f0..1fb3395c286 100644
--- a/audio/xamp/patches/patch-af
+++ b/audio/xamp/patches/patch-af
@@ -1,12 +1,20 @@
-$NetBSD: patch-af,v 1.1 1999/11/15 13:07:12 rh Exp $
-
---- ../audioIO.h.orig Sat May 31 19:47:58 1997
-+++ ../audioIO.h Mon Nov 15 13:58:45 1999
-@@ -26,3 +26,7 @@
- #ifdef OS_SunOS
- #define AUSIZ 4096
- #endif
-+
-+#ifdef OS_NetBSD
-+ #define AUSIZ 32768
-+#endif
+diff -c ../audioIO.h:1.1.1.1 xamp/audioIO.h:1.2
+*** ../audioIO.h:1.1.1.1 Wed Jun 14 22:23:47 2000
+--- ../audioIO.h Wed Jun 14 22:23:47 2000
+***************
+*** 7,13 ****
+ #define AUSIZ 32768
+ #endif
+
+! #ifdef OS_Linux
+ extern int AUSIZ;
+ #endif
+
+--- 7,13 ----
+ #define AUSIZ 32768
+ #endif
+
+! #if defined(OS_Linux) || defined(OS_NetBSD)
+ extern int AUSIZ;
+ #endif
+
diff --git a/audio/xamp/patches/patch-ag b/audio/xamp/patches/patch-ag
index 608ba040344..e61857869b9 100644
--- a/audio/xamp/patches/patch-ag
+++ b/audio/xamp/patches/patch-ag
@@ -1,26 +1,204 @@
-$NetBSD: patch-ag,v 1.1 1999/11/15 13:07:12 rh Exp $
-
---- ../audioIO_SunOS.c.orig Sat May 31 19:47:58 1997
-+++ ../audioIO_SunOS.c Mon Nov 15 13:58:45 1999
-@@ -8,7 +8,11 @@
-
- #include "amp.h"
- #include <sys/types.h>
-+#ifndef OS_NetBSD
- #include <sys/stropts.h>
-+#else
-+#include <sys/ioctl.h>
-+#endif
- #include <fcntl.h>
- #include <unistd.h>
- #include <stdio.h>
-@@ -36,8 +40,7 @@
- }
- DB(audio, msg("Audio device opened on %d\n",audio_fd) );
-
-- if (ioctl(audio_fd,AUDIO_GETINFO,&auinfo)<0)
-- die("Unable to get audio info\n");
-+ AUDIO_INITINFO(&auinfo);
-
- auinfo.play.precision=16;
- auinfo.play.encoding=AUDIO_ENCODING_LINEAR;
+diff -c /dev/null ../audioIO_NetBSD.c:1.3
+*** /dev/null Wed Jun 14 22:24:24 2000
+--- ../audioIO_NetBSD.c Wed Jun 14 22:24:25 2000
+***************
+*** 0 ****
+--- 1,198 ----
++ /* this file is a part of amp software, (C) tomislav uzelac 1996,1997
++
++ Origional code by: tomislav uzelac
++ Modified by:
++ * Dan Nelson - BSD mods.
++ * Andrew Richards - moved code from audio.c and added mixer support etc
++ * Brett Lymn - NetBSD support & 8bit mode.
++ */
++
++ /* Support for NetBSD sound devices */
++
++ #include "amp.h"
++ #include <sys/types.h>
++ #include <sys/stat.h>
++ #include <sys/ioctl.h>
++ #include <fcntl.h>
++ #include <unistd.h>
++ #include <stdio.h>
++ #include <stdio.h>
++ #include <errno.h>
++ #include <string.h>
++ #include <malloc.h>
++ #include <stdlib.h>
++ #include <sys/types.h>
++ #include <sys/audioio.h>
++ #include <sys/param.h>
++ #include <sys/filio.h>
++ #include <sys/stat.h>
++ #include <sys/param.h>
++ #include <sys/ioctl.h>
++ #include <fcntl.h>
++ #include <signal.h>
++ #include <soundcard.h>
++ #include "audioIO.h"
++
++ /* optimal fragment size - if this is set too high you will get clicks
++ * in the audio output, below is near the upper limit for the sb sound driver
++ * on my machine (Toshiba 400CDT laptop).
++ */
++
++ int AUSIZ = 20480;
++
++ /* declare these static to effectively isolate the audio device */
++
++ static int audio_fd;
++ static int mixer_fd;
++ static int volumeIoctl;
++
++ static char *reduce;
++
++ /* audioOpen() */
++ /* should open the audio device, perform any special initialization */
++ /* Set the frequency, no of channels and volume. Volume is only set if */
++ /* it is not -1 */
++
++ void
++ audioOpen(int frequency, int stereo, int volume)
++ {
++ audio_info_t audio_dev;
++ int supportedMixers;
++
++ if ((audio_fd = open ("/dev/audio", O_WRONLY, 0)) == -1)
++ die("Unable to open the audio device\n");
++ DB(audio, msg("Audio device opened on %d\n",audio_fd); )
++
++ if ((mixer_fd=open("/dev/mixer",O_RDWR)) == -1)
++ warn("Unable to open mixer device\n");
++ DB(audio, msg("Mixer device opened on %d\n",mixer_fd) );
++
++ if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &supportedMixers) == -1) {
++ warn("Unable to get mixer info assuming master volume\n");
++ volumeIoctl=SOUND_MIXER_WRITE_VOLUME;
++ } else {
++ if ((supportedMixers & SOUND_MASK_PCM) != 0)
++ volumeIoctl=SOUND_MIXER_WRITE_PCM;
++ else
++ volumeIoctl=0;
++ }
++
++ ioctl(audio_fd, AUDIO_GETINFO, &audio_dev); /* get current settings */
++ AUDIO_INITINFO(&audio_dev);
++
++ /* Set 1 or 2 channels */
++ audio_dev.play.channels = (stereo ? 2 : 1);
++
++ /* Set the output frequency */
++ DB(audio, msg("Setting freq to %d Hz\n",frequency) );
++ audio_dev.play.sample_rate = frequency;
++
++ if (volume != -1)
++ audioSetVolume(volume);
++
++ audio_dev.blocksize = AUSIZ;
++ audio_dev.play.encoding = AUDIO_ENCODING_SLINEAR;
++ audio_dev.hiwat = 20;
++ audio_dev.lowat = 1;
++ audio_dev.mode = AUMODE_PLAY;
++
++ if (ioctl(audio_fd, AUDIO_SETINFO, &audio_dev) < 0)
++ die("AUDIO_SETINFO failed\n");
++
++ /* ok - try running the sound system at 16 bits, if that does not
++ * work then try 8 bits, if that does not work, give up.
++ */
++ reduce = NULL;
++ audio_dev.play.precision = 16;
++ if (ioctl(audio_fd, AUDIO_SETINFO, &audio_dev) < 0) {
++ DB(audio,
++ msg("AUDIO_SETINFO for 16 bits failed, try 8 bits\n"));
++ if ((reduce = (char *) malloc(AUSIZ * sizeof(char))) == NULL)
++ die("Cannot malloc reduce buffer\n");
++ audio_dev.play.precision = 8;
++ if (ioctl(audio_fd, AUDIO_SETINFO, &audio_dev) < 0)
++ die("AUDIO_SETINFO failed both 16bit and 8bit\n");
++ AUSIZ = AUSIZ * sizeof(short);
++ }
++ }
++
++
++ /* audioSetVolume - only code this if your system can change the volume while */
++ /* playing. sets the output volume 0-100 */
++
++ void
++ audioSetVolume(int volume)
++ {
++ DB(audio, msg("Setting volume to: %d\n",volume); )
++
++ volume=(volume<<8)+volume;
++ if ((mixer_fd != -1) && (volumeIoctl!=0))
++ if (ioctl(mixer_fd, volumeIoctl, &volume) < 0)
++ warn("Unable to set sound volume\n");
++ }
++
++
++ /* audioFlush() */
++ /* should flush the audio device */
++
++ inline void
++ audioFlush()
++ {
++ DB(audio, msg("audio: flush %d\n",audio_fd) );
++
++ if (ioctl(audio_fd, SNDCTL_DSP_RESET, 0) == -1)
++ die("Unable to reset audio device\n");
++ }
++
++
++ /* audioClose() */
++ /* should close the audio device and perform any special shutdown */
++
++ void
++ audioClose()
++ {
++ close(audio_fd);
++ if (mixer_fd != -1)
++ close(mixer_fd);
++ DB(audio, msg("audio: closed %d\n",audio_fd) );
++ }
++
++ /* audioWrite */
++ /* writes count bytes from buffer to the audio device */
++ /* returns the number of bytes actually written */
++
++ inline int
++ audioWrite(char *buffer, int count)
++ {
++ int i;
++ short *cast;
++
++ DB(audio, msg("audio: Writing %d bytes to audio descriptor %d\n",count,
++ getAudioFd()) );
++
++ /* if the reduce buffer is allocated we need to do 8bit writes
++ * so munge the data buffer appropriately.
++ */
++ if (reduce != NULL) {
++ cast = (short *) buffer;
++
++ for (i=0; i < count/sizeof(short); i++) {
++ reduce[i] = cast[i] >> 8;
++ }
++ return (sizeof(short) * write(audio_fd, reduce,
++ count/sizeof(short)));
++ } else {
++ return(write(audio_fd,buffer,count));
++ }
++ }
++
++ /* Let buffer.c have the audio descriptor so it can select on it. This means */
++ /* that the program is dependent on a file descriptor to work. Should really */
++ /* move the select's etc (with inlines of course) in here so that this is the */
++ /* ONLY file which has hardware dependent audio stuff in it */
++
++ int
++ getAudioFd()
++ {
++ return(audio_fd);
++ }
diff --git a/audio/xamp/patches/patch-aj b/audio/xamp/patches/patch-aj
new file mode 100644
index 00000000000..0134fe51c7f
--- /dev/null
+++ b/audio/xamp/patches/patch-aj
@@ -0,0 +1,33 @@
+diff -c ../amp.h:1.1.1.1 xamp/amp.h:1.2
+*** ../amp.h:1.1.1.1 Wed Jun 14 22:23:47 2000
+--- ../amp.h Wed Jun 14 22:23:47 2000
+***************
+*** 13,22 ****
+ #define MINOR 7
+ #define PATCH 6
+
+ #define MAX(a,b) ((a) > (b) ? (a) : (b))
+ #define MAX3(a,b,c) ((a) > (b) ? MAX(a, c) : MAX(b, c))
+ #define MIN(a,b) ((a) < (b) ? (a) : (b))
+!
+
+ /* Debugging flags */
+
+--- 13,29 ----
+ #define MINOR 7
+ #define PATCH 6
+
++ #ifdef OS_NetBSD
++ #include <sys/param.h>
++ #endif
++
++ #ifndef OS_NetBSD
+ #define MAX(a,b) ((a) > (b) ? (a) : (b))
++ #endif
+ #define MAX3(a,b,c) ((a) > (b) ? MAX(a, c) : MAX(b, c))
++ #ifndef OS_NetBSD
+ #define MIN(a,b) ((a) < (b) ? (a) : (b))
+! #endif
+
+ /* Debugging flags */
+
diff --git a/audio/xamp/patches/patch-ak b/audio/xamp/patches/patch-ak
new file mode 100644
index 00000000000..bfd2bcf773c
--- /dev/null
+++ b/audio/xamp/patches/patch-ak
@@ -0,0 +1,30 @@
+diff -c ../buffer.c:1.1.1.1 xamp/buffer.c:1.2
+*** ../buffer.c:1.1.1.1 Wed Jun 14 22:23:45 2000
+--- ../buffer.c Wed Jun 14 22:23:45 2000
+***************
+*** 226,232 ****
+
+ percentFull=100*bufferSize(&audioBuffer)/AUDIO_BUFFER_SIZE;
+ #if defined(DEBUG)
+! if ((cntr++ % (16/(AUSIZ/4096)))==0) msg("\rBuffer (%2d%%) %6d",percentFull,bufferSize(&audioBuffer));
+ #endif
+ if (AUSIZ>bytesToEnd) {
+ cnt = audioWrite(audioBuffer.bufferPtr + audioBuffer.outPos, bytesToEnd);
+--- 226,242 ----
+
+ percentFull=100*bufferSize(&audioBuffer)/AUDIO_BUFFER_SIZE;
+ #if defined(DEBUG)
+! if (AUSIZ >= 4096) {
+! if ((cntr++ % (16/(AUSIZ/4096)))==0)
+! msg("\nBuffer(%2d%%) %6d\n",
+! percentFull,
+! bufferSize(&audioBuffer));
+! } else {
+! if ((cntr++ % (16 * AUSIZ)) == 0)
+! msg("\nBuffer(%2d%%) %6d\n",
+! percentFull,
+! bufferSize(&audioBuffer));
+! }
+ #endif
+ if (AUSIZ>bytesToEnd) {
+ cnt = audioWrite(audioBuffer.bufferPtr + audioBuffer.outPos, bytesToEnd);
diff --git a/audio/xamp/patches/patch-al b/audio/xamp/patches/patch-al
new file mode 100644
index 00000000000..c897978b26a
--- /dev/null
+++ b/audio/xamp/patches/patch-al
@@ -0,0 +1,24 @@
+diff -c ../configure.in:1.1.1.1 xamp/configure.in:1.4
+*** ../configure.in:1.1.1.1 Wed Jun 14 22:23:51 2000
+--- ../configure.in Wed Jun 14 22:23:51 2000
+***************
+*** 73,78 ****
+--- 73,90 ----
+ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
+ ;;
+
++ NetBSD)
++ if test "$ARCH_TYPE" = "i486" ; then
++ CFLAGS_ARCH="-m486"
++ fi
++ if test "$ARCH_TYPE" = "i586" ; then
++ CFLAGS_ARCH="-i586 -pipe"
++ fi
++ CFLAGS="-O6 -ffast-math -fomit-frame-pointer"
++ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
++ LDFLAGS="-lossaudio"
++ ;;
++
+ SunOS)
+ if test "$CC" = "gcc"; then
+ CFLAGS="-O6 -Dinline= "
diff --git a/audio/xamp/patches/patch-am b/audio/xamp/patches/patch-am
new file mode 100644
index 00000000000..cad82da2288
--- /dev/null
+++ b/audio/xamp/patches/patch-am
@@ -0,0 +1,24 @@
+diff -c ../configure:1.1.1.1 xamp/configure:1.2
+*** ../configure:1.1.1.1 Wed Jun 14 22:24:22 2000
+--- ../configure Wed Jun 14 22:24:22 2000
+***************
+*** 1413,1418 ****
+--- 1413,1430 ----
+ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
+ ;;
+
++ NetBSD)
++ if test "$ARCH_TYPE" = "i486" ; then
++ CFLAGS_ARCH="-m486"
++ fi
++ if test "$ARCH_TYPE" = "i586" ; then
++ CFLAGS_ARCH="-i586 -pipe"
++ fi
++ CFLAGS="-O6 -ffast-math -fomit-frame-pointer"
++ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
++ LDFLAGS="-lossaudio"
++ ;;
++
+ SunOS)
+ if test "$CC" = "gcc"; then
+ CFLAGS="-O6 -Dinline= "