summaryrefslogtreecommitdiff
path: root/audio/maplay
diff options
context:
space:
mode:
authoraugustss <augustss>1997-10-28 23:49:37 +0000
committeraugustss <augustss>1997-10-28 23:49:37 +0000
commit9c32f4fc8a5dbc07976b508cd27ff67f8a34b2d5 (patch)
treeb19eb21bcb8a6214758b0008a34987ea7cf11660 /audio/maplay
parent7dc68e10e99f1eb7e3259489d24b950bc8808eef (diff)
downloadpkgsrc-9c32f4fc8a5dbc07976b508cd27ff67f8a34b2d5.tar.gz
Change RCS Id.
NetBSD port.
Diffstat (limited to 'audio/maplay')
-rw-r--r--audio/maplay/Makefile3
-rw-r--r--audio/maplay/patches/patch-ad229
2 files changed, 231 insertions, 1 deletions
diff --git a/audio/maplay/Makefile b/audio/maplay/Makefile
index ddbab2f3af6..cec8862cd6c 100644
--- a/audio/maplay/Makefile
+++ b/audio/maplay/Makefile
@@ -3,7 +3,8 @@
# Date created: Feb 13 1995
# Whom: jkh
#
-# $Id: Makefile,v 1.1.1.1 1997/10/28 23:18:31 augustss Exp $
+# $NetBSD: Makefile,v 1.2 1997/10/28 23:49:37 augustss Exp $
+# FreeBSD Id: Makefile,v 1.6 1997/01/07 14:58:04 torstenb Exp
#
DISTNAME= maplay1_2
diff --git a/audio/maplay/patches/patch-ad b/audio/maplay/patches/patch-ad
new file mode 100644
index 00000000000..7bb5f02586b
--- /dev/null
+++ b/audio/maplay/patches/patch-ad
@@ -0,0 +1,229 @@
+diff -u ../work/configuration.sh ./configuration.sh
+--- ../work/configuration.sh Sun Oct 26 12:31:52 1997
++++ ./configuration.sh Sun Oct 26 12:19:41 1997
+@@ -72,6 +72,12 @@
+ INCLUDEDIRS=
+ LIBRARIES=
+ AUDIO_INCLUDES='#include <sys/audioio.h>' ;;
++ NetBSD*)
++ COMPILER=g++
++ COMPILERFLAGS='-O2 -m486 -DNETBSD'
++ INCLUDEDIRS=
++ LIBRARIES=
++ AUDIO_INCLUDES='#include <sys/audioio.h>' ;;
+ FreeBSD*)
+ COMPILER=g++
+ COMPILERFLAGS='-O2 -m486 -DLINUX -DDAMN_INTEL_BYTE_ORDER'
+diff -u ../work/header.cc ./header.cc
+--- ../work/header.cc Sun Oct 26 12:31:52 1997
++++ ./header.cc Sun Oct 26 12:25:28 1997
+@@ -48,8 +48,8 @@
+ cerr << "invalid syncword 0x";
+ cerr.width (8);
+ cerr.fill ('0');
+- cerr << hex << headerstring
+- << " found at fileoffset " << dec
++ cerr << headerstring
++ << " found at fileoffset "
+ << lseek (stream->filedescriptor (), 0, SEEK_CUR) - 4 << '\n';
+ return False;
+ }
+diff -u ../work/ibitstream.cc ./ibitstream.cc
+--- ../work/ibitstream.cc Sun Oct 26 12:31:52 1997
++++ ./ibitstream.cc Sun Oct 26 12:17:22 1997
+@@ -33,6 +33,12 @@
+ #include "all.h"
+ #include "ibitstream.h"
+
++#ifdef NETBSD
++#include <machine/endian.h>
++#if BYTE_ORDER == LITTLE_ENDIAN
++#define DAMN_INTEL_BYTE_ORDER
++#endif
++#endif
+
+ #define swap_int32(int_32) (((int_32) << 24) | (((int_32) << 8) & 0x00ff0000) | \
+ (((int_32) >> 8) & 0x0000ff00) | ((int_32) >> 24))
+diff -u ../work/maplay.cc ./maplay.cc
+--- ../work/maplay.cc Sun Oct 26 12:31:52 1997
++++ ./maplay.cc Sun Oct 26 12:18:30 1997
+@@ -323,6 +323,17 @@
+ Exit (0);
+ }
+ #else
++#ifdef NETBSD
++ {
++ if (NetBSDObuffer::class_suitable (mode == single_channel || which_channels != both) ? 1 : 2)
++ if (mode == single_channel || which_channels != both)
++ buffer = new NetBSDObuffer (1, header);
++ else
++ buffer = new NetBSDObuffer (2, header);
++ else
++ Exit (0);
++ }
++#else
+ //#ifdef your_machine
+ // {
+ // if (mode == single_channel || which_channels != both)
+@@ -337,6 +348,7 @@
+ Exit (0);
+ }
+ //#endif // !your_machine
++#endif // !NETBSD
+ #endif // !LINUX
+ #endif // !SPARC
+ #endif // !Indigo
+diff -u ../work/obuffer.cc ./obuffer.cc
+--- ../work/obuffer.cc Sun Oct 26 12:31:52 1997
++++ ./obuffer.cc Sun Oct 26 12:32:53 1997
+@@ -639,3 +639,122 @@
+ }
+
+ #endif /* LINUX */
++
++#ifdef NETBSD
++int NetBSDObuffer::audio_fd = -1;
++
++int NetBSDObuffer::open_audio_device (void)
++{
++ int fd;
++
++ if ((fd = open ("/dev/audio", O_WRONLY | O_NDELAY, 0)) < 0)
++ if (errno == EBUSY)
++ {
++ cerr << "Sorry, the audio device is busy!\n";
++ exit (1);
++ }
++ else
++ {
++ perror ("can't open /dev/audio for writing");
++ exit (1);
++ }
++
++ int flags;
++ if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
++ {
++ perror ("fcntl F_GETFL on /dev/audio failed");
++ exit (1);
++ }
++ flags &= ~O_NDELAY;
++ if (fcntl (fd, F_SETFL, flags) < 0)
++ {
++ perror ("fcntl F_SETFL on /dev/audio failed");
++ exit (1);
++ }
++ return fd;
++}
++
++
++NetBSDObuffer::NetBSDObuffer (uint32 number_of_channels, Header *header)
++{
++#ifdef DEBUG
++ if (!number_of_channels || number_of_channels > MAXCHANNELS)
++ {
++ cerr << "NetBSDObuffer: 0 < number of channels < " << MAXCHANNELS << "!\n";
++ exit (1);
++ }
++#endif
++ channels = number_of_channels;
++ for (int i = 0; i < number_of_channels; ++i)
++ bufferp[i] = buffer + i;
++
++ if (audio_fd < 0)
++ {
++ cerr << "Internal error, NetBSDObuffer::audio_fd has to be initialized\n"
++ "by NetBSDObuffer::class_suitable()!\n";
++ exit (1);
++ }
++
++ audio_info info;
++ AUDIO_INITINFO(&info);
++
++ // configure the device:
++ info.play.encoding = AUDIO_ENCODING_SLINEAR;
++ info.play.precision = 16;
++ info.play.channels = channels;
++ info.play.sample_rate = header->frequency ();
++
++ if (ioctl (audio_fd, AUDIO_SETINFO, &info))
++ {
++ perror ("configuration of /dev/audio failed");
++ exit (1);
++ }
++}
++
++
++NetBSDObuffer::~NetBSDObuffer (void)
++{
++ close (audio_fd);
++}
++
++
++void NetBSDObuffer::append (uint32 channel, int16 value)
++{
++#ifdef DEBUG
++ if (channel >= channels)
++ {
++ cerr << "illegal channelnumber in NetBSDObuffer::append()!\n";
++ exit (1);
++ }
++ if (bufferp[channel] - buffer >= OBUFFERSIZE)
++ {
++ cerr << "buffer overflow!\n";
++ exit (1);
++ }
++#endif
++ *bufferp[channel] = value;
++ bufferp[channel] += channels;
++}
++
++
++void NetBSDObuffer::write_buffer (int)
++{
++ int length = (int)((char *)bufferp[0] - (char *)buffer);
++ if (write (audio_fd, buffer, length) != length)
++ {
++ perror ("write to /dev/audio failed");
++ exit (1);
++ }
++ for (int i = 0; i < channels; ++i)
++ bufferp[i] = buffer + i;
++}
++
++
++boolean NetBSDObuffer::class_suitable (uint32 number_of_channels)
++{
++ // open the dsp audio device:
++ audio_fd = open_audio_device ();
++ return True;
++}
++
++#endif /* NETBSD */
+diff -u ../work/obuffer.h ./obuffer.h
+--- ../work/obuffer.h Sun Oct 26 12:31:52 1997
++++ ./obuffer.h Sun Oct 26 12:19:16 1997
+@@ -163,4 +163,24 @@
+ };
+ #endif // LINUX
+
++#ifdef NETBSD
++class NetBSDObuffer : public Obuffer
++{
++ int16 buffer[OBUFFERSIZE];
++ int16 *bufferp[MAXCHANNELS];
++ uint32 channels;
++ static int audio_fd;
++
++ static int open_audio_device (void);
++
++public:
++ NetBSDObuffer (uint32 number_of_channels, Header *);
++ ~NetBSDObuffer (void);
++ void append (uint32 channel, int16 value);
++ void write_buffer (int dummy);
++
++ static boolean class_suitable (uint32 number_of_channels);
++};
++#endif // LINUX
++
+ #endif