summaryrefslogtreecommitdiff
path: root/audio/timidity
diff options
context:
space:
mode:
authormycroft <mycroft@pkgsrc.org>1998-03-07 18:49:40 +0000
committermycroft <mycroft@pkgsrc.org>1998-03-07 18:49:40 +0000
commit343bfd9fd421908733167b1a55e01541f26b9312 (patch)
treeee3bd5c237fe8dce46fb5adffe5cd7f1a3cecd19 /audio/timidity
parentde2c07c0bb18cbb8570ef7359dcad55fefba3e1e (diff)
downloadpkgsrc-343bfd9fd421908733167b1a55e01541f26b9312.tar.gz
Use the native audio interface.
Fix (and enable) the Tk interface; it just runs wish externally. Fix the Motif interface as well, but don't enable it by default (yet?). Throw in my SGI port `because it's there'.
Diffstat (limited to 'audio/timidity')
-rw-r--r--audio/timidity/patches/patch-aa93
-rw-r--r--audio/timidity/patches/patch-ab66
-rw-r--r--audio/timidity/patches/patch-ae41
-rw-r--r--audio/timidity/patches/patch-ba21
-rw-r--r--audio/timidity/patches/patch-bb149
-rw-r--r--audio/timidity/patches/patch-bc20
-rw-r--r--audio/timidity/patches/patch-bd164
7 files changed, 403 insertions, 151 deletions
diff --git a/audio/timidity/patches/patch-aa b/audio/timidity/patches/patch-aa
deleted file mode 100644
index 61ede5e056d..00000000000
--- a/audio/timidity/patches/patch-aa
+++ /dev/null
@@ -1,93 +0,0 @@
-*** mix.c.orig Mon May 20 17:09:46 1996
---- mix.c Sun Nov 17 10:01:36 1996
-***************
-*** 23,29 ****
---- 23,33 ----
-
- #include <math.h>
- #include <stdio.h>
-+ #if defined(__FreeBSD__) || defined(__NetBSD__)
-+ #include <stdlib.h>
-+ #else
- #include <malloc.h>
-+ #endif
-
- #include "config.h"
- #include "common.h"
-*** resample.c.orig Mon May 20 17:09:47 1996
---- resample.c Sun Nov 17 09:59:29 1996
-***************
-*** 22,28 ****
---- 22,32 ----
-
- #include <math.h>
- #include <stdio.h>
-+ #if defined(__FreeBSD__) || defined(__NetBSD__)
-+ #include <stdlib.h>
-+ #else
- #include <malloc.h>
-+ #endif
-
- #include "config.h"
- #include "common.h"
---- config.h.orig Sat Jun 1 13:54:49 1996
-+++ config.h Mon Jan 26 13:52:44 1998
-@@ -185,6 +185,11 @@
- fragments under the VoxWare (Linux & FreeBSD) audio driver */
- #define AUDIO_BUFFER_SIZE (1<<AUDIO_BUFFER_BITS)
-
-+#if (defined(__unix__) || defined(unix)) && !defined(USG)
-+#include <sys/param.h>
-+#undef FSCALE
-+#endif
-+
- /* Byte order, defined in <machine/endian.h> for FreeBSD and DEC OSF/1 */
- #ifdef DEC
- #include <machine/endian.h>
-@@ -217,6 +222,22 @@
- # endif
- #endif /* linux */
-
-+#if (defined(BSD) && BSD >= 199306)
-+#include <errno.h>
-+#include <machine/endian.h>
-+#if BYTE_ORDER == LITTLE_ENDIAN
-+#undef BIG_ENDIAN
-+#undef PDP_ENDIAN
-+#elif BYTE_ORDER == BIG_ENDIAN
-+#undef LITTLE_ENDIAN
-+#undef PDP_ENDIAN
-+#else
-+# error No valid byte sex defined
-+#endif
-+#define USE_LDEXP
-+#define PI M_PI
-+#endif
-+
- /* Win32 on Intel machines */
- #ifdef __WIN32__
- # define LITTLE_ENDIAN
-@@ -254,13 +275,23 @@
- #ifdef LITTLE_ENDIAN
- #define LE_SHORT(x) x
- #define LE_LONG(x) x
-+#ifdef __FreeBSD__
-+#define BE_SHORT(x) __byte_swap_word(x)
-+#define BE_LONG(x) __byte_swap_long(x)
-+#else
- #define BE_SHORT(x) XCHG_SHORT(x)
- #define BE_LONG(x) XCHG_LONG(x)
-+#endif
- #else
- #define BE_SHORT(x) x
- #define BE_LONG(x) x
-+#ifdef __FreeBSD__
-+#define LE_SHORT(x) __byte_swap_word(x)
-+#define LE_LONG(x) __byte_swap_long(x)
-+#else
- #define LE_SHORT(x) XCHG_SHORT(x)
- #define LE_LONG(x) XCHG_LONG(x)
-+#endif
- #endif
-
- #define MAX_AMPLIFICATION 800
diff --git a/audio/timidity/patches/patch-ab b/audio/timidity/patches/patch-ab
index 2be41b82d9e..4b6c14ad369 100644
--- a/audio/timidity/patches/patch-ab
+++ b/audio/timidity/patches/patch-ab
@@ -1,13 +1,13 @@
---- Makefile.orig Sun May 26 10:26:46 1996
-+++ Makefile Mon Jan 26 16:54:39 1998
+--- Makefile.orig Sun May 26 05:26:46 1996
++++ Makefile Sat Mar 7 13:17:50 1998
@@ -24,22 +24,23 @@
# But where to change without revealing my secret identity?
########### Compiler and flags.
-CC = gcc
-DEBUGFLAGS = -Wall -O2
-+#CC = gcc
-+DEBUGFLAGS = -Wall
++CC = cc
++DEBUGFLAGS = -Wall -O3 -fomit-frame-pointer -funroll-loops -ffast-math
########### Install.
-INSTALL = /usr/bin/install
@@ -30,31 +30,63 @@
# Where to install the Tcl code, if you use the Tcl code that is.
TCL_DIR = $(TIMID_DIR)
-@@ -93,8 +94,8 @@
+@@ -54,8 +55,8 @@
+ # do some axe work.
+
+ # Select the Linux/FreeBSD audio driver
+-SYSTEM += -DAU_LINUX
+-SYSEXTRAS += linux_a.c
++#SYSTEM += -DAU_LINUX
++#SYSEXTRAS += linux_a.c
+ #EXTRAINCS +=
+ #EXTRALIBS +=
+
+@@ -77,6 +78,18 @@
+ #EXTRAINCS += -I/usr/demo/SOUND/include
+ #EXTRALIBS += -L/usr/demo/SOUND/lib -laudio -lsocket
+
++## Select the Sun audio driver (for NetBSD)
++SYSTEM += -DAU_SUN
++SYSEXTRAS += sun_a.c
++EXTRAINCS +=
++EXTRALIBS +=
++
++## Select the IRIX audio driver
++#SYSTEM += -DAU_SGI
++#SYSEXTRAS += sgi_a.c
++#EXTRAINCS +=
++#EXTRALIBS += -laudio
++
+ ## Select the DEC MMS audio server
+ #SYSTEM += -DDEC -DAU_DEC
+ #SYSEXTRAS += dec_a.c
+@@ -93,8 +106,8 @@
# Select the ncurses full-screen interface
SYSTEM += -DIA_NCURSES
SYSEXTRAS += ncurs_c.c
-EXTRAINCS += -I/usr/include/ncurses
-EXTRALIBS += -lncurses
+EXTRAINCS += -I${PREFIX}/include
-+EXTRALIBS += -L${PREFIX}/lib -lncurses -lossaudio
++EXTRALIBS += -L${PREFIX}/lib -lncurses
## Select the S-Lang full-screen interface
#SYSTEM += -DIA_SLANG
-@@ -112,9 +113,9 @@
+@@ -112,11 +125,11 @@
#EXTRALIBS += -lgen
# Select the Tcl/Tk interface
-SYSTEM += -DTCLTK -DWISH=\"wishx\" -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\"
--SYSEXTRAS += tk_c.c
--INST_TK = install.tk
-+#SYSTEM += -DTCLTK -DWISH=\"wishx\" -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\"
-+#SYSEXTRAS += tk_c.c
-+#INST_TK = install.tk
- #EXTRAINCS +=
- #EXTRALIBS +=
++SYSTEM += -DTCLTK -DWISH=\"wish8.0\" -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\"
+ SYSEXTRAS += tk_c.c
+ INST_TK = install.tk
+-#EXTRAINCS +=
+-#EXTRALIBS +=
++EXTRAINCS +=
++EXTRALIBS +=
+
+ ########### Now check out the options in config.h
-@@ -136,7 +137,7 @@
+@@ -136,7 +149,7 @@
SDIST = timidity-lib-$(SUPPVERSION).tar.gz
SDISTZIP = tilib$(FNSUPPVERSION).zip
@@ -63,7 +95,7 @@
-DTIMID_VERSION=\"$(VERSION)\" $(SYSTEM) $(EXTRAINCS)
########### All relevant files.. Anybody know autoconf?
-@@ -228,10 +229,10 @@
+@@ -228,10 +241,10 @@
wav2pat: wav2pat.c
$(CC) $(CFLAGS) -o wav2pat wav2pat.c
@@ -78,7 +110,7 @@
########### Installation targets
-@@ -262,9 +263,9 @@
+@@ -262,9 +275,9 @@
mkdir -p $(TIMID_DIR)
$(INSTALL) -m 644 $(CONFIGF) $(TIMID_DIR)
diff --git a/audio/timidity/patches/patch-ae b/audio/timidity/patches/patch-ae
deleted file mode 100644
index 58bd081d4ed..00000000000
--- a/audio/timidity/patches/patch-ae
+++ /dev/null
@@ -1,41 +0,0 @@
---- linux_a.c Mon May 20 15:09:46 1996
-+++ ./linux_a.c Wed Oct 29 01:09:19 1997
-@@ -32,6 +32,16 @@
- #include <linux/soundcard.h>
- #endif
-
-+#ifdef __NetBSD__
-+#include <sys/ioctl.h>
-+#include <soundcard.h>
-+#undef EINTR
-+#define EINTR EWOULDBLOCK
-+#define DEV "/dev/audio"
-+#else
-+#define DEV "/dev/dsp"
-+#endif
-+
- #ifdef __FreeBSD__
- #include <stdio.h>
- #include <machine/soundcard.h>
-@@ -56,7 +66,7 @@
- -1,
- {0}, /* default: get all the buffer fragments you can */
- "Linux dsp device", 'd',
-- "/dev/dsp",
-+ DEV,
- open_output,
- close_output,
- output_data,
-@@ -220,10 +230,10 @@
-
- static void flush_output(void)
- {
-- ioctl(dpm.fd, SNDCTL_DSP_SYNC);
-+ ioctl(dpm.fd, SNDCTL_DSP_SYNC, 0);
- }
-
- static void purge_output(void)
- {
-- ioctl(dpm.fd, SNDCTL_DSP_RESET);
-+ ioctl(dpm.fd, SNDCTL_DSP_RESET, 0);
- }
diff --git a/audio/timidity/patches/patch-ba b/audio/timidity/patches/patch-ba
new file mode 100644
index 00000000000..470fe16326b
--- /dev/null
+++ b/audio/timidity/patches/patch-ba
@@ -0,0 +1,21 @@
+--- config.h.orig Sat Jun 1 08:54:49 1996
++++ config.h Sat Mar 7 13:17:30 1998
+@@ -325,6 +325,18 @@
+ #define rindex(s,c) strrchr(s,c)
+ #endif
+
++#ifdef __NetBSD__
++# include <errno.h>
++# include <math.h>
++# define PI M_PI
++#endif
++
++#ifdef sgi
++# include <errno.h>
++# include <math.h>
++# define PI M_PI
++#endif
++
+ #ifdef __WIN32__
+ # include <math.h>
+ # define PI M_PI
diff --git a/audio/timidity/patches/patch-bb b/audio/timidity/patches/patch-bb
new file mode 100644
index 00000000000..db4e28c5d1f
--- /dev/null
+++ b/audio/timidity/patches/patch-bb
@@ -0,0 +1,149 @@
+--- motif_c.c.orig Mon May 20 09:14:09 1996
++++ motif_c.c Sat Mar 7 13:19:57 1998
+@@ -370,15 +370,10 @@
+ */
+ static int ctl_read(int32 *valp)
+ {
+- int num;
+-
+- /* We don't wan't to lock on reading */
+- num=pipe_read_ready();
+-
+- if (num==0)
+- return RC_NONE;
+-
+- return(ctl_blocking_read(valp));
++ if (pipe_read_ready())
++ return(ctl_blocking_read(valp));
++ else
++ return RC_NONE;
+ }
+
+ static void ctl_pass_playing_list(int number_of_files, char *list_of_files[])
+--- motif_p.c.orig Mon May 20 09:09:46 1996
++++ motif_p.c Sat Mar 7 13:22:05 1998
+@@ -29,7 +29,11 @@
+ #include <stdarg.h>
+ #include <sys/ioctl.h>
+ #ifdef SOLARIS
+-#include <sys/filio.h>
++#include <sys/stropts.h>
++#endif
++#ifdef sgi
++#include <sys/time.h>
++#include <bstring.h>
+ #endif
+
+ #include "config.h"
+@@ -39,6 +43,9 @@
+ int pipeAppli[2],pipeMotif[2]; /* Pipe for communication with MOTIF process */
+ int fpip_in, fpip_out; /* in and out depends in which process we are */
+ int pid; /* Pid for child process */
++#ifdef sgi
++static fd_set selector;
++#endif
+
+ /* DATA VALIDITY CHECK */
+ #define INT_CODE 214
+@@ -146,7 +153,20 @@
+ {
+ int num;
+
++#ifdef sgi
++ static struct timeval zero = {0, 0};
++ FD_SET(fpip_in, &selector);
++ num = select(fpip_in + 1, &selector, (fd_set *)0, (fd_set *)0, &zero);
++ if (num < 0)
++ pipe_error("pipe_read_ready");
++ num = FD_ISSET(fpip_in, &selector);
++#else
++#ifdef SOLARIS
++ ioctl(fpip_in,I_NREAD,&num); /* see how many chars in buffer. */
++#else
+ ioctl(fpip_in,FIONREAD,&num); /* see how many chars in buffer. */
++#endif
++#endif
+ return num;
+ }
+
+--- output.c.orig Mon May 20 10:04:54 1996
++++ output.c Sat Mar 7 13:31:24 1998
+@@ -48,6 +48,11 @@
+ #define DEFAULT_PLAY_MODE &sun_play_mode
+ #endif
+
++#ifdef AU_SGI
++extern PlayMode sgi_play_mode;
++#define DEFAULT_PLAY_MODE &sgi_play_mode
++#endif
++
+ #ifdef AU_WIN32
+ extern PlayMode win32_play_mode;
+ #define DEFAULT_PLAY_MODE &win32_play_mode
+--- tk_c.c.orig Mon May 20 09:14:24 1996
++++ tk_c.c Sat Mar 7 13:27:08 1998
+@@ -17,6 +17,13 @@
+ #include <stdarg.h>
+ #include <string.h>
+ #include <sys/ioctl.h>
++#ifdef SOLARIS
++#include <sys/stropts.h>
++#endif
++#ifdef sgi
++#include <sys/time.h>
++#include <bstring.h>
++#endif
+
+ #include "config.h"
+ #include "common.h"
+@@ -362,15 +369,10 @@
+ */
+ static int ctl_read(int32 *valp)
+ {
+- int num;
+-
+- /* We don't wan't to lock on reading */
+- num=pipe_read_ready();
+-
+- if (num==0)
+- return RC_NONE;
+-
++ if (pipe_read_ready())
+ return(ctl_blocking_read(valp));
++ else
++ return RC_NONE;
+ }
+
+ static void ctl_pass_playing_list(int number_of_files, char *list_of_files[])
+@@ -439,6 +441,9 @@
+ static int pipeAppli[2],pipePanel[2]; /* Pipe for communication with Tcl/Tk process */
+ static int fpip_in, fpip_out; /* in and out depends in which process we are */
+ static int pid; /* Pid for child process */
++#ifdef sgi
++static fd_set selector;
++#endif
+
+ static void pipe_open()
+ {
+@@ -477,7 +482,21 @@
+ static int pipe_read_ready()
+ {
+ int num;
++
++#ifdef sgi
++ static struct timeval zero = {0, 0};
++ FD_SET(fpip_in, &selector);
++ num = select(fpip_in + 1, &selector, (fd_set *)0, (fd_set *)0, &zero);
++ if (num < 0)
++ pipe_error("pipe_read_ready");
++ num = FD_ISSET(fpip_in, &selector);
++#else
++#ifdef SOLARIS
++ ioctl(fpip_in,I_NREAD,&num); /* see how many chars in buffer. */
++#else
+ ioctl(fpip_in,FIONREAD,&num); /* see how many chars in buffer. */
++#endif
++#endif
+ return num;
+ }
+
diff --git a/audio/timidity/patches/patch-bc b/audio/timidity/patches/patch-bc
new file mode 100644
index 00000000000..cf693004a2d
--- /dev/null
+++ b/audio/timidity/patches/patch-bc
@@ -0,0 +1,20 @@
+--- sun_a.c.orig Mon May 20 09:09:47 1996
++++ sun_a.c Sat Mar 7 13:28:46 1998
+@@ -33,7 +33,7 @@
+
+ #include <sys/ioctl.h>
+
+-#ifdef SOLARIS
++#if defined(SOLARIS) || defined(__NetBSD__)
+ #include <sys/audioio.h>
+ #else
+ #include <sun/audioio.h>
+@@ -81,7 +81,7 @@
+
+ /* Open the audio device */
+
+-#ifdef SOLARIS
++#if defined(SOLARIS) || defined(__NetBSD__)
+ fd=open(dpm.name, O_RDWR );
+ #else
+ fd=open(dpm.name, O_RDWR | O_NDELAY);
diff --git a/audio/timidity/patches/patch-bd b/audio/timidity/patches/patch-bd
new file mode 100644
index 00000000000..d81e7f29f1c
--- /dev/null
+++ b/audio/timidity/patches/patch-bd
@@ -0,0 +1,164 @@
+--- /dev/null Sat Mar 7 13:11:05 1998
++++ sgi_a.c Sat Mar 7 13:30:25 1998
+@@ -0,0 +1,161 @@
++/*
++
++ TiMidity -- Experimental MIDI to WAVE converter
++ Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++
++ sgi_audio.c
++
++ Functions to play sound on a SGI's audio device.
++
++ THESE ARE UNTESTED -- If you need to make modifications to get
++ them to work, please send me the diffs, preferrably with a brief
++ explanation of what was wrong. Thanks!
++
++*/
++
++#include <unistd.h>
++#include <fcntl.h>
++#include <errno.h>
++
++#include <sys/ioctl.h>
++
++#include <audio.h>
++
++#include "config.h"
++#include "output.h"
++#include "controls.h"
++
++static int open_output(void); /* 0=success, 1=warning, -1=fatal error */
++static void close_output(void);
++static void output_data(int32 *buf, int32 count);
++static void flush_output(void);
++static void purge_output(void);
++
++/* export the playback mode */
++
++#define dpm sgi_play_mode
++
++PlayMode dpm = {
++ DEFAULT_RATE, PE_16BIT|PE_SIGNED,
++ -1,
++ {0,0,0,0,0}, /* no extra parameters so far */
++ "SGI audio device", 'd',
++ NULL,
++ open_output,
++ close_output,
++ output_data,
++ flush_output,
++ purge_output
++};
++
++static ALport port;
++static ALconfig config;
++
++/*************************************************************************/
++/*
++ Encoding will be 16-bit linear signed, unless PE_ULAW is set, in
++ which case it'll be 8-bit uLaw. I don't think it's worthwhile to
++ implement any 8-bit linear modes as the sound quality is
++ unrewarding. PE_MONO is honored. */
++
++static int open_output(void)
++{
++ int warnings=0;
++ long params[2];
++
++ /* Open the audio device */
++
++ config = ALnewconfig();
++
++ /* Does any device need byte-swapped data? Turn the bit off here. */
++ dpm.encoding &= ~PE_BYTESWAP;
++
++ ctl->cmsg(CMSG_INFO,VERB_DEBUG,
++ "1. (dpm.encoding=0x%02x dpm.rate=%d)",
++ dpm.encoding, dpm.rate);
++
++ /* Select 16-bit linear / 8-bit uLaw encoding */
++
++ dpm.encoding &= ~PE_ULAW;
++ dpm.encoding |= PE_16BIT|PE_SIGNED;
++ ALsetwidth(config, AL_SAMPLE_16);
++ ALsetsampfmt(config, AL_SAMPFMT_TWOSCOMP);
++
++ if (dpm.encoding & PE_MONO)
++ ALsetchannels(config, AL_MONO);
++ else
++ ALsetchannels(config, AL_STEREO);
++
++ ALsetqueuesize(config, 32768);
++
++ port = ALopenport("tiMIDIty audio", "w", config);
++
++ if (port == 0)
++ {
++ ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
++ "Can't open audio port");
++ return -1;
++ }
++
++ params[0] = AL_OUTPUT_RATE;
++ params[1] = dpm.rate;
++ ALsetparams(AL_DEFAULT_DEVICE, params, 2);
++ ALgetparams(AL_DEFAULT_DEVICE, params, 2);
++
++ if (dpm.rate != params[1])
++ {
++ dpm.rate = params[1];
++ ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
++ "Output rate adjusted to %d Hz", dpm.rate);
++ warnings=1;
++ }
++
++ ctl->cmsg(CMSG_INFO,VERB_DEBUG,
++ "1. (dpm.encoding=0x%02x dpm.rate=%d)",
++ dpm.encoding, dpm.rate);
++
++ return warnings;
++}
++
++static void output_data(int32 *buf, int32 count)
++{
++ /* Convert data to signed 16-bit PCM */
++ if (dpm.encoding & PE_MONO)
++ {
++ s32tos16(buf, count);
++ ALwritesamps(port, buf, count);
++ }
++ else
++ {
++ s32tos16(buf, count * 2);
++ ALwritesamps(port, buf, count * 2);
++ }
++}
++
++static void close_output(void)
++{
++ ALcloseport(port);
++ ALfreeconfig(config);
++}
++
++static void flush_output(void)
++{
++}
++
++static void purge_output(void)
++{
++}