summaryrefslogtreecommitdiff
path: root/audio/xamp/patches
diff options
context:
space:
mode:
authorrh <rh@pkgsrc.org>2000-10-18 11:22:42 +0000
committerrh <rh@pkgsrc.org>2000-10-18 11:22:42 +0000
commite37e6d06d150f72e561d7d78ec3abbb30774bb89 (patch)
treeb6d3ad90af82d8f48361fe4cf0f23af583715b2b /audio/xamp/patches
parent415bf3a264a2049fe3e324d1b1ae9a1820220226 (diff)
downloadpkgsrc-e37e6d06d150f72e561d7d78ec3abbb30774bb89.tar.gz
Update xamp to 0.8.10 (from PR 11250 by Rui-Xiang Guo
<rxg@ms25.url.com.tw>, the maintainer of this package). Changes are bugfixes, and use of the native NetBSD sound API instead of OSS emulation.
Diffstat (limited to 'audio/xamp/patches')
-rw-r--r--audio/xamp/patches/patch-aa31
-rw-r--r--audio/xamp/patches/patch-ac86
-rw-r--r--audio/xamp/patches/patch-ae27
-rw-r--r--audio/xamp/patches/patch-af33
-rw-r--r--audio/xamp/patches/patch-ag449
-rw-r--r--audio/xamp/patches/patch-ah24
-rw-r--r--audio/xamp/patches/patch-ai30
-rw-r--r--audio/xamp/patches/patch-aj56
-rw-r--r--audio/xamp/patches/patch-ak53
-rw-r--r--audio/xamp/patches/patch-al44
-rw-r--r--audio/xamp/patches/patch-am44
-rw-r--r--audio/xamp/patches/patch-an15
-rw-r--r--audio/xamp/patches/patch-ao14
-rw-r--r--audio/xamp/patches/patch-ap14
-rw-r--r--audio/xamp/patches/patch-aq14
-rw-r--r--audio/xamp/patches/patch-ar14
16 files changed, 534 insertions, 414 deletions
diff --git a/audio/xamp/patches/patch-aa b/audio/xamp/patches/patch-aa
index 1fbdfbb5f0e..a91d5859590 100644
--- a/audio/xamp/patches/patch-aa
+++ b/audio/xamp/patches/patch-aa
@@ -1,16 +1,15 @@
-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
+$NetBSD: patch-aa,v 1.4 2000/10/18 11:22:44 rh Exp $
+
+--- ../audioIO.c.orig Sat May 31 23:47:58 1997
++++ ../audioIO.c Sun Oct 1 15:47:54 2000
+@@ -6,6 +6,10 @@
+ #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-ac b/audio/xamp/patches/patch-ac
index 11899cb6691..45b92d7a280 100644
--- a/audio/xamp/patches/patch-ac
+++ b/audio/xamp/patches/patch-ac
@@ -1,65 +1,81 @@
-$NetBSD: patch-ac,v 1.1.1.1 1999/09/17 00:48:27 hubertf Exp $
+$NetBSD: patch-ac,v 1.2 2000/10/18 11:22:44 rh Exp $
---- QtAMP.cpp Wed Feb 11 17:53:35 1998
-+++ QtAMP.cpp Wed Jul 29 22:21:08 1998
-@@ -24,10 +24,9 @@
+--- QtAMP.cpp.orig Fri Jul 31 22:29:58 1998
++++ QtAMP.cpp Tue Oct 17 17:48:13 2000
+@@ -24,10 +24,12 @@
#include <sys/types.h>
#include <sys/stat.h>
--#include <sched.h>
++#ifndef OS_NetBSD
+ #include <sched.h>
++#include <sys/soundcard.h>
++#endif
#include <sys/socket.h>
#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-+#include <soundcard.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <errno.h>
-@@ -84,11 +84,11 @@
- splash->show();
-
- // init mixer
--#ifdef OS_Linux
-+#if defined(OS_Linux) || defined(OS_NetBSD)
+@@ -89,7 +91,11 @@
if ((mixer = open("/dev/mixer", O_RDWR)) < 0)
die("Error opening /dev/mixer, exiting\n");
ioctl(mixer, SOUND_MIXER_READ_PCM, &v);
-#endif OS_Linux
+#endif
++
++#ifdef OS_NetBSD
++ audioSetMixer();
++#endif
/* where mine resource file is located */
char home[500];
-@@ -262,7 +262,7 @@
-
- QtAMP::~QtAMP()
- {
--#ifdef OS_Linux
-+#if defined(OS_Linux) || defined(OS_NetBSD)
- close(mixer);
- #endif
- real_quit();
-@@ -348,7 +348,7 @@
- sprintf(volum,"Volume: %d",vr);
- playLabel->setText( volum );
- // printf("%d %d\n",tvr,tv);
--#ifdef OS_Linux
-+#if defined(OS_Linux) || defined(OS_NetBSD)
+@@ -428,6 +434,13 @@
int x = (tv*256 + tvl);
ioctl(mixer, SOUND_MIXER_WRITE_PCM, &x);
#endif
-@@ -884,14 +884,14 @@
- {
- if (mute == 1)
- {
--#ifdef OS_Linux
-+#if defined(OS_Linux) || defined(OS_NetBSD)
++
++#ifdef OS_NetBSD
++ if (tvr == 0)
++ audioSetVolume(vr);
++ else
++ audioSetBalance(vr, tvr);
++#endif
+ }
+
+ void QtAMP::bal_slider_moved(int bal)
+@@ -437,6 +450,10 @@
+ sprintf(volum,"Balance: %d",tvr);
+ vol_slider_moved(vr);
+ playLabel->setText( volum );
++
++#ifdef OS_NetBSD
++ audioSetBalance(vr, tvr);
++#endif
+ }
+
+ void QtAMP::bal_slider_released()
+@@ -1077,12 +1094,24 @@
int x = (tv*256 + tvl);
ioctl(mixer, SOUND_MIXER_WRITE_PCM, &x);
#endif
++
++#ifdef OS_NetBSD
++ int vr = 0;
++ audioSetVolume(vr);
++#endif
}
if (mute == 0)
{
--#ifdef OS_Linux
-+#if defined(OS_Linux) || defined(OS_NetBSD)
+ #ifdef OS_Linux
int x = (7*256 + 7);
ioctl(mixer, SOUND_MIXER_WRITE_PCM, &x);
++#endif
++
++#ifdef OS_NetBSD
++ if (tvr == 0)
++ audioSetVolume(vr);
++ else
++ audioSetBalance(vr, tvr);
#endif
+ }
+ mute=!mute;
diff --git a/audio/xamp/patches/patch-ae b/audio/xamp/patches/patch-ae
index f432081c137..bb19d466dc6 100644
--- a/audio/xamp/patches/patch-ae
+++ b/audio/xamp/patches/patch-ae
@@ -1,26 +1,33 @@
-$NetBSD: patch-ae,v 1.3 2000/03/28 00:09:21 dmcmahill Exp $
+$NetBSD: patch-ae,v 1.4 2000/10/18 11:22:44 rh Exp $
---- Makefile.in.orig Tue Feb 10 17:37:20 1998
-+++ Makefile.in Sun Mar 26 13:58:33 2000
-@@ -15,5 +15,6 @@
- CFLAGS = @CFLAGS@ ${DEFINES} ${DEBUG} ${BACK}
+--- Makefile.in.orig Fri Jul 31 01:48:02 1998
++++ Makefile.in Mon Oct 16 16:22:20 2000
+@@ -15,8 +15,8 @@
+ DEFINES = -DOS_@OS_TYPE@ -DARCH_@ARCH_TYPE@
+ CFLAGS = @CFLAGS@ ${DEFINES} ${DEBUG} ${BACK} -Wall
LDFLAGS = @LDFLAGS@
-INSTALL= @INSTALL@
+-DESTDIR= ${prefix}/bin
+INSTALL= @INSTALL@ -s
+DESTDIR= ${PREFIX}/bin
#
-@@ -38,5 +39,5 @@
- backs/backs.o
+ # uncomment both of these if you want profiling support
+@@ -38,7 +38,7 @@
+ mabout.o maboutData.o dirDlg.o mdirDlg.o dirDlgData.o mdirDlgData.o \
+ id3.o id3Data.o QLayer.o mid3.o mid3Data.o pixmaps/pixmaps.o
-LIBS = @QT_LDFLAGS@ -lm -lqt
-+LIBS = @QT_LDFLAGS@ -lm -L${X11BASE}/qt1/lib -Wl,-R${X11BASE}/qt1/lib -L${X11BASE}/lib -Wl,-R,$(X11BASE)/lib -lqt -lX11 -lXext
++LIBS = @QT_LDFLAGS@ -lm -lqt -Wl,-R${X11BASE}/qt1/lib -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lX11 -lXext
all: xamp
-@@ -60,5 +61,5 @@
+
+@@ -58,7 +58,7 @@
+ cd pixmaps ; make
xamp: images $(OBJ)
- $(CC) -o xamp $(OBJ) $(LDFLAGS) $(LIBS)
-+ $(CXX) -o xamp $(OBJ) $(LDFLAGS) $(LIBS) -lossaudio
++ $(CXX) -o xamp $(OBJ) $(LDFLAGS) $(LIBS)
install:
+ $(INSTALL) -m 755 xamp $(DESTDIR)/xamp
diff --git a/audio/xamp/patches/patch-af b/audio/xamp/patches/patch-af
index 1fb3395c286..418eb259e9e 100644
--- a/audio/xamp/patches/patch-af
+++ b/audio/xamp/patches/patch-af
@@ -1,20 +1,13 @@
-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
-
+$NetBSD: patch-af,v 1.3 2000/10/18 11:22:44 rh Exp $
+
+--- ../audioIO.h.orig Sat May 31 23:47:58 1997
++++ ../audioIO.h Sun Oct 1 15:47:55 2000
+@@ -7,7 +7,7 @@
+ #define AUSIZ 32768
+ #endif
+
+-#ifdef OS_Linux
++#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 e61857869b9..6a358130155 100644
--- a/audio/xamp/patches/patch-ag
+++ b/audio/xamp/patches/patch-ag
@@ -1,204 +1,245 @@
-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);
-+ }
+$NetBSD: patch-ag,v 1.3 2000/10/18 11:22:44 rh Exp $
+
+--- ../audioIO_NetBSD.c.orig Tue Oct 17 17:50:54 2000
++++ ../audioIO_NetBSD.c Tue Oct 17 20:01:20 2000
+@@ -0,0 +1,240 @@
++/* 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.
++ * Rui-Xiang Guo - NetBSD native API support.
++ */
++
++/* Support for NetBSD sound devices */
++
++#include "amp.h"
++#include "audioIO.h"
++#include <fcntl.h>
++#include <unistd.h>
++#include <stdio.h>
++#include <errno.h>
++#include <string.h>
++#include <malloc.h>
++#include <stdlib.h>
++#include <signal.h>
++#include <sys/audioio.h>
++#include <sys/param.h>
++#include <sys/filio.h>
++#include <sys/param.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/ioctl.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 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;
++
++ 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));
++
++ 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 */
++
++int device_id = 3;
++char *mixer_device;
++mixer_ctrl_t *values;
++mixer_devinfo_t *infos;
++
++void
++audioSetMixer()
++{
++ int i, ndev;
++ mixer_devinfo_t dinfo;
++
++ mixer_device = getenv("MIXERDEVICE");
++ if (mixer_device == NULL)
++ mixer_device = "/dev/mixer0";
++
++ if ((mixer_fd = open(mixer_device, O_RDWR)) < 0)
++ warn("Unable to open mixer device\n");
++ DB(audio, msg("Mixer device opened on %d\n", mixer_fd));
++
++ for (ndev = 0; ; ndev++) {
++ dinfo.index = ndev;
++ if (ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &dinfo) < 0)
++ break;
++ }
++ infos = calloc(ndev, sizeof *infos);
++ values = calloc(ndev, sizeof *values);
++
++ for (i = 0; i < ndev; i++) {
++ infos[i].index = i;
++ ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &infos[i]);
++ }
++
++ for (i = 0; i < ndev; i++) {
++ if (infos[i].type == AUDIO_MIXER_VALUE) {
++ values[i].dev = i;
++ values[i].type = infos[i].type;
++ }
++ }
++
++ values[device_id].un.value.num_channels = 2;
++}
++
++void
++audioSetVolume(int volume)
++{
++ mixer_ctrl_t *m;
++
++ DB(audio, msg("Setting volume to: %d\n", volume));
++ m = &values[device_id];
++
++ if (ioctl(mixer_fd, AUDIO_MIXER_WRITE, m) < 0)
++ warn("Unable to set sound volume\n");
++
++ m->un.value.level[0] = m->un.value.level[1] = volume * AUDIO_MAX_GAIN / 100;
++}
++
++void
++audioSetBalance(int volume, int balance)
++{
++ mixer_ctrl_t *m;
++
++ DB(audio, msg("Setting volume to: %d\n", volume));
++ DB(audio, msg("Setting balance to: %d\n", balance));
++ m = &values[device_id];
++
++ if (ioctl(mixer_fd, AUDIO_MIXER_WRITE, m) < 0)
++ warn("Unable to set sound volume\n");
++
++ if (balance < 0) {
++ m->un.value.level[0] = volume * AUDIO_MAX_GAIN / 100;
++ m->un.value.level[1] = m->un.value.level[0] * (20 + balance) / 20;
++ }
++ else {
++ m->un.value.level[1] = volume * AUDIO_MAX_GAIN / 100;
++ m->un.value.level[0] = m->un.value.level[1] * (20 - balance) / 20;
++ }
++}
++
++/* audioFlush() */
++/* should flush the audio device */
++
++inline void
++audioFlush()
++{
++ DB(audio, msg("audio: flush %d\n", audio_fd));
++}
++
++
++/* 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-ah b/audio/xamp/patches/patch-ah
index ca05d7af6bf..977560b6115 100644
--- a/audio/xamp/patches/patch-ah
+++ b/audio/xamp/patches/patch-ah
@@ -1,11 +1,19 @@
-$NetBSD: patch-ah,v 1.3 2000/03/28 00:09:21 dmcmahill Exp $
+$NetBSD: patch-ah,v 1.4 2000/10/18 11:22:44 rh Exp $
---- configure.in.orig Sun Oct 5 12:42:34 1997
-+++ configure.in Sun Mar 26 13:59:52 2000
-@@ -58,5 +58,5 @@
+--- configure.in.orig Sun Oct 5 22:42:34 1997
++++ configure.in Mon Oct 16 21:08:33 2000
+@@ -71,6 +71,14 @@
+ CFLAGS="-O6 -ffast-math -fomit-frame-pointer -DNO_BYTE_SWAPPING ${CFLAGS_ARCH}"
;;
-- Linux|FreeBSD)
-+ Linux|FreeBSD|NetBSD)
- CC="gcc"
- if test "$ARCH_TYPE" = "i486" ; then
++ NetBSD)
++ CC="gcc"
++ if test "$ARCH_TYPE" = "i386" ; then
++ CFLAGS_ARCH="-i586 -pipe"
++ fi
++ CFLAGS="-O6 -ffast-math -fomit-frame-pointer -DNO_BYTE_SWAPPING ${CFLAGS_ARCH}"
++ ;;
++
+ SunOS)
+ if test "$CC" = "gcc"; then
+ CFLAGS="-O6"
diff --git a/audio/xamp/patches/patch-ai b/audio/xamp/patches/patch-ai
index a88fb93da81..f70ca157d4f 100644
--- a/audio/xamp/patches/patch-ai
+++ b/audio/xamp/patches/patch-ai
@@ -1,18 +1,28 @@
-$NetBSD: patch-ai,v 1.3 2000/03/28 00:09:21 dmcmahill Exp $
+$NetBSD: patch-ai,v 1.4 2000/10/18 11:22:44 rh Exp $
---- configure.orig Sun Oct 26 11:55:34 1997
-+++ configure Sun Mar 26 14:37:02 2000
-@@ -971,5 +971,5 @@
+--- configure.orig Sun Oct 26 22:55:34 1997
++++ configure Mon Oct 16 21:09:00 2000
+@@ -970,7 +970,7 @@
+ #try to guess qt locations
qt_incdirs="/usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt $x_includes $QTINC"
-test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
+test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR/include/qt $QTDIR $qt_incdirs"
qt_incdir=NO
-@@ -1701,5 +1701,5 @@
+ for i in $qt_incdirs;
+@@ -1710,6 +1710,14 @@
+ fi
+ if test "$OS_TYPE" = "FreeBSD" ; then
+ OS_TYPE="BSD"
++ fi
++ CFLAGS="-O6 -ffast-math -fomit-frame-pointer -DNO_BYTE_SWAPPING ${CFLAGS_ARCH}"
++ ;;
++
++ NetBSD)
++ CC="gcc"
++ if test "$ARCH_TYPE" = "i386" ; then
++ CFLAGS_ARCH="-i586 -pipe"
+ fi
+ CFLAGS="-O6 -ffast-math -fomit-frame-pointer -DNO_BYTE_SWAPPING ${CFLAGS_ARCH}"
;;
-
-- Linux|FreeBSD)
-+ Linux|FreeBSD|NetBSD)
- CC="gcc"
- if test "$ARCH_TYPE" = "i486" ; then
diff --git a/audio/xamp/patches/patch-aj b/audio/xamp/patches/patch-aj
index 0134fe51c7f..f0e294595e7 100644
--- a/audio/xamp/patches/patch-aj
+++ b/audio/xamp/patches/patch-aj
@@ -1,33 +1,23 @@
-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 */
-
+$NetBSD: patch-aj,v 1.2 2000/10/18 11:22:44 rh Exp $
+
+--- ../amp.h.orig Tue Aug 19 05:33:30 1997
++++ ../amp.h Sun Oct 1 15:47:56 2000
+@@ -13,10 +13,17 @@
+ #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
index bfd2bcf773c..04ef374fcac 100644
--- a/audio/xamp/patches/patch-ak
+++ b/audio/xamp/patches/patch-ak
@@ -1,30 +1,23 @@
-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);
+$NetBSD: patch-ak,v 1.2 2000/10/18 11:22:44 rh Exp $
+
+--- ../buffer.c.orig Sat Dec 13 06:58:08 1997
++++ ../buffer.c Sun Oct 1 15:47:56 2000
+@@ -226,7 +226,17 @@
+
+ percentFull=100*bufferSize(&audioBuffer)/AUDIO_BUFFER_SIZE;
+ #if defined(DEBUG)
+- if ((cntr++ % (16/(AUSIZ/4096)))==0) msg("\rBuffer (%2d%%) %6d",percentFull,bufferSize(&audioBuffer));
++ 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
index c897978b26a..3d6db2db242 100644
--- a/audio/xamp/patches/patch-al
+++ b/audio/xamp/patches/patch-al
@@ -1,24 +1,20 @@
-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= "
+$NetBSD: patch-al,v 1.2 2000/10/18 11:22:44 rh Exp $
+
+--- ../configure.in.orig Sat Aug 23 17:35:40 1997
++++ ../configure.in Mon Oct 16 21:12:37 2000
+@@ -73,6 +73,15 @@
+ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
+ ;;
+
++ NetBSD)
++ CC="gcc"
++ if test "$ARCH_TYPE" = "i386" ; then
++ CFLAGS_ARCH="-i586 -pipe"
++ fi
++ CFLAGS="-O6 -ffast-math -fomit-frame-pointer ${CFLAGS_ARCH}"
++ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
++ ;;
++
+ SunOS)
+ if test "$CC" = "gcc"; then
+ CFLAGS="-O6 -Dinline= "
diff --git a/audio/xamp/patches/patch-am b/audio/xamp/patches/patch-am
index cad82da2288..1d09640316d 100644
--- a/audio/xamp/patches/patch-am
+++ b/audio/xamp/patches/patch-am
@@ -1,24 +1,20 @@
-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= "
+$NetBSD: patch-am,v 1.2 2000/10/18 11:22:44 rh Exp $
+
+--- ../configure.orig Sat Aug 23 17:11:24 1997
++++ ../configure Mon Oct 16 21:13:14 2000
+@@ -1413,6 +1413,15 @@
+ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
+ ;;
+
++ NetBSD)
++ CC="gcc"
++ if test "$ARCH_TYPE" = "i386" ; then
++ CFLAGS_ARCH="-i586 -pipe"
++ fi
++ CFLAGS="-O6 -ffast-math -fomit-frame-pointer ${CFLAGS_ARCH}"
++ DEFINES="-DNO_BYTE_SWAPPING -DOS_$OS_TYPE -DARCH_$ARCH_TYPE"
++ ;;
++
+ SunOS)
+ if test "$CC" = "gcc"; then
+ CFLAGS="-O6 -Dinline= "
diff --git a/audio/xamp/patches/patch-an b/audio/xamp/patches/patch-an
new file mode 100644
index 00000000000..ee6a39975f3
--- /dev/null
+++ b/audio/xamp/patches/patch-an
@@ -0,0 +1,15 @@
+$NetBSD: patch-an,v 1.1 2000/10/18 11:22:44 rh Exp $
+
+--- ../proto.h.orig Sat May 31 23:47:58 1997
++++ ../proto.h Tue Oct 17 16:23:23 2000
+@@ -6,6 +6,10 @@
+ void debugOptions();
+
+ /* From: audioIO_<OSTYPE>.c */
++#ifdef OS_NetBSD
++void audioSetMixer();
++void audioSetBalance(int, int);
++#endif
+ void audioOpen(int frequency, int stereo, int volume);
+ void audioSetVolume(int);
+ void audioFlush();
diff --git a/audio/xamp/patches/patch-ao b/audio/xamp/patches/patch-ao
new file mode 100644
index 00000000000..a0bcca9e0cd
--- /dev/null
+++ b/audio/xamp/patches/patch-ao
@@ -0,0 +1,14 @@
+$NetBSD: patch-ao,v 1.1 2000/10/18 11:22:44 rh Exp $
+
+--- plDlgData.cpp.orig Mon Feb 2 14:16:06 1998
++++ plDlgData.cpp Tue Jan 25 01:34:41 2000
+@@ -18,6 +18,9 @@
+ #include <qlabel.h>
+ #include <qkeycode.h>
+
++#define QColor(i) (QColor)(i)
++#define QRgb(i) (QRgb)(i)
++
+ plDlgData::plDlgData
+ (
+ QWidget* parent,
diff --git a/audio/xamp/patches/patch-ap b/audio/xamp/patches/patch-ap
new file mode 100644
index 00000000000..a89b03e8355
--- /dev/null
+++ b/audio/xamp/patches/patch-ap
@@ -0,0 +1,14 @@
+$NetBSD: patch-ap,v 1.1 2000/10/18 11:22:45 rh Exp $
+
+--- QtAMPData.cpp.orig Tue Jan 25 01.35.30 2000
++++ QtAMPData.cpp Tue Jan 25 01:35:55 2000
+@@ -19,6 +19,9 @@
+ #include <qkeycode.h>
+ #include <qtooltip.h>
+
++#define QColor(i) (QColor)(i)
++#define QRgb(i) (QRgb)(i)
++
+ QtAMPData::QtAMPData
+ (
+ QWidget* parent,
diff --git a/audio/xamp/patches/patch-aq b/audio/xamp/patches/patch-aq
new file mode 100644
index 00000000000..ed782c206b2
--- /dev/null
+++ b/audio/xamp/patches/patch-aq
@@ -0,0 +1,14 @@
+$NetBSD: patch-aq,v 1.1 2000/10/18 11:22:45 rh Exp $
+
+--- dirDlgData.cpp.orig Tue Jan 25 01:36:16 2000
++++ dirDlgData.cpp Tue Jan 25 01:36:43 2000
+@@ -6,6 +6,9 @@
+ #include <qframe.h>
+ #include <qlabel.h>
+
++#define QColor(i) (QColor)(i)
++#define QRgb(i) (QRgb)(i)
++
+ dirDlgData::dirDlgData
+ (
+ QWidget* parent,
diff --git a/audio/xamp/patches/patch-ar b/audio/xamp/patches/patch-ar
new file mode 100644
index 00000000000..e494e8a4c91
--- /dev/null
+++ b/audio/xamp/patches/patch-ar
@@ -0,0 +1,14 @@
+$NetBSD: patch-ar,v 1.1 2000/10/18 11:22:45 rh Exp $
+
+--- id3Data.cpp.orig Tue Jan 25 01:37:13 2000
++++ id3Data.cpp Tue Jan 25 01:37:40 2000
+@@ -17,6 +17,9 @@
+ #include <qframe.h>
+ #include <qlabel.h>
+
++#define QColor(i) (QColor)(i)
++#define QRgb(i) (QRgb)(i)
++
+ id3Data::id3Data
+ (
+ QWidget* parent,