summaryrefslogtreecommitdiff
path: root/audio/liveice/patches/patch-ab
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2001-05-05 10:05:34 +0000
committerwiz <wiz@pkgsrc.org>2001-05-05 10:05:34 +0000
commitf8ed6311b03b795a98ef01d4f47269924200400b (patch)
tree0e274f69dfe62bcf0351a117ad68d5c0a0b047ff /audio/liveice/patches/patch-ab
parentf4141cd9fb85d69bb5370e561fd4520d16bca499 (diff)
downloadpkgsrc-f8ed6311b03b795a98ef01d4f47269924200400b.tar.gz
Use patches supplied by Andrew Hobgood in pkg/12159 to support NetBSD's
native audio system instead of liboss emulation. Fix PLIST while I'm here.
Diffstat (limited to 'audio/liveice/patches/patch-ab')
-rw-r--r--audio/liveice/patches/patch-ab125
1 files changed, 122 insertions, 3 deletions
diff --git a/audio/liveice/patches/patch-ab b/audio/liveice/patches/patch-ab
index 78de2701858..47e1660bc33 100644
--- a/audio/liveice/patches/patch-ab
+++ b/audio/liveice/patches/patch-ab
@@ -1,16 +1,135 @@
-$NetBSD: patch-ab,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
+$NetBSD: patch-ab,v 1.2 2001/05/05 10:05:34 wiz Exp $
---- streams.c.orig Tue Nov 21 03:30:12 2000
+--- streams.c.orig Tue May 23 20:08:00 2000
+++ streams.c
@@ -36,7 +36,11 @@
#ifdef HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
#else
+#ifdef __NetBSD__
-+#include <soundcard.h>
++#include <sys/audioio.h>
+#else
#include <machine/soundcard.h>
+#endif /* __NetBSD__ */
#endif
#endif
#include <sys/ioctl.h>
+@@ -77,11 +81,23 @@
+ {
+ int format,stereo,speed,caps;
+ #ifdef SOUNDCARD_SUPPORT
++
++#ifdef __NetBSD__
++ audio_info_t ctlinfo;
++#endif /* __NetBSD__ */
++
+ fprintf(stderr,"Initialising Soundcard\n");
+
++#ifdef __NetBSD__
++ if((g_conf.audioctl_fd=open(g_conf.netbsd_audioctl_file,O_RDWR))==-1)
++ fatal("Failed to open audioctl device");
++ if((g_conf.audio_fd=open(g_conf.netbsd_audio_file,O_RDONLY))==-1)
++#else
+ if((g_conf.audio_fd=open(g_conf.sound_input_file,O_RDWR))==-1)
++#endif /* __NetBSD__ */
+ fatal("Failed to open sound device");
+
++#ifndef __NetBSD__
+ /* see if the card can do full_duplex */
+ if(g_conf.full_duplex){
+ ioctl(g_conf.audio_fd, SNDCTL_DSP_GETCAPS, &caps);
+@@ -97,7 +113,33 @@
+ g_conf.full_duplex=0;
+ }
+ }
++#endif /* __NetBSD__ */
+
++#ifdef __NetBSD__
++ if(ioctl(g_conf.audioctl_fd, AUDIO_GETINFO, &(g_conf.ctlrestore)) < 0)
++ fatal("ioctl(AUDIO_GETINFO) failed");
++
++ /* in theory, we should pull ctlrestore.record.buffer_size and use
++ that to malloc() our audio buffer, but in practice, this has
++ shown to be unneccesary. This will minimize impact to the
++ original source and reduce the amount of patching we need.
++ */
++
++ /* somewhere in here, we should be able to check/set full duplex,
++ but I don't know enough about the internals of this driver yet.
++ */
++ g_conf.full_duplex = 0;
++
++ AUDIO_INITINFO(&ctlinfo);
++ ctlinfo.record.sample_rate = g_conf.sample_rate;
++ ctlinfo.record.channels = (g_conf.stereo ? 2 : 1);
++ ctlinfo.record.precision = 16;
++ ctlinfo.record.encoding = AUDIO_ENCODING_SLINEAR_LE;
++ ctlinfo.mode = AUMODE_RECORD;
++
++ if(ioctl(g_conf.audioctl_fd, AUDIO_SETINFO, &ctlinfo) < 0)
++ fatal("ioctl(AUDIO_SETINFO) failed");
++#else
+ ioctl(g_conf.audio_fd, SNDCTL_DSP_GETFMTS, &format);
+ if(!(format&AFMT_S16_LE))
+ fatal("16bit mode not supported by driver");
+@@ -113,6 +155,7 @@
+ speed=g_conf.sample_rate;
+ if(ioctl(g_conf.audio_fd,SNDCTL_DSP_SPEED,&speed)==-1)
+ fatal("Speed Setting failed\n");
++#endif /* __NetBSD__ */
+
+
+ fprintf(stderr,"16Bit %dHz ",g_conf.sample_rate);
+@@ -121,8 +164,10 @@
+ if(g_conf.full_duplex)
+ fprintf(stderr,"Full Duplex ");
+ fprintf(stderr,"\n");
++#ifndef __NetBSD__
+ close(g_conf.audio_fd);
+ g_conf.audio_fd=0;
++#endif /* __NetBSD__ */
+ #else
+ write_message("This executable Doesn't Support Soundcards",0);
+ #endif
+@@ -136,9 +181,10 @@
+ #ifdef SOUNDCARD_SUPPORT
+ write_message("Opening Soundcard",1);
+
++#ifndef __NetBSD__
+ if((g_conf.audio_fd=open(g_conf.sound_input_file,flags))==-1)
+ fatal("Failed to open sound device");
+-
++
+ if(g_conf.full_duplex)
+ #ifdef HAVE_SYS_SOUNDCARD_H
+ ioctl(g_conf.audio_fd, SNDCTL_DSP_SETDUPLEX, 0);
+@@ -157,6 +203,7 @@
+ speed=g_conf.sample_rate;
+ if(ioctl(g_conf.audio_fd,SNDCTL_DSP_SPEED,&speed)==-1)
+ fatal("Speed Setting failed\n");
++#endif /* __NetBSD__ */
+ #else
+ write_message("This executable Doesn't Support Soundcards",0);
+ #endif
+@@ -166,8 +213,21 @@
+ {
+ #ifdef SOUNDCARD_SUPPORT
+ write_message("Closing Soundcard",1);
++#ifdef __NetBSD__
++ close(g_conf.audio_fd);
++
++ /* In theory, we should reset the device. In practice, this
++ segfaults. I haven't figured out why.
++
++ if(ioctl(g_conf.audioctl_fd, AUDIO_SETINFO, &(g_conf.ctlrestore)) < 0)
++ fatal("ioctl(AUDIO_SETINFO) failed");
++ */
++
++ close(g_conf.audioctl_fd);
++#else
+ ioctl(g_conf.audio_fd, SNDCTL_DSP_RESET, 0);
+ close(g_conf.audio_fd);
++#endif /* __NetBSD__ */
+ #else
+ write_message("This executable Doesn't Support Soundcards",0);
+ #endif