diff -ruN ump.orig/Makefile.am ump/Makefile.am --- ump.orig/Makefile.am Thu Jan 1 09:00:00 1970 +++ ump/Makefile.am Sat Apr 17 23:58:19 1999 @@ -0,0 +1,91 @@ +# TiMidity++ -- MIDI to WAVE converter and player +# Copyright (C) 1999 Masanao Izumo +# Copyright (C) 1995 Tuukka Toivonen +# +# 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. +# +# This Makefile is known to work with GNU make. + +include $(top_srcdir)/common.makefile + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libarc \ + -I$(top_srcdir)/interface \ + -I$(top_srcdir)/utils \ + -I$(top_srcdir)/timidity \ + $(EXTRAINCS) + +noinst_LIBRARIES = libump.a + +libump_a_SOURCES = \ + npunix.c \ + UnixShell.c \ + plugin_c.c + +EXTRA_DIST = \ + npunix.c \ + UnixShell.c \ + plugin_c.c \ + jri.h \ + jri_md.h \ + jritypes.h \ + npapi.h \ + npupp.h \ + minusdn.xpm \ + minusup.xpm \ + pausedn.xpm \ + pauseup.xpm \ + playdn.xpm \ + playup.xpm \ + plusdn.xpm \ + plusup.xpm \ + stopdn.xpm \ + stopup.xpm \ + ump.xpm + +######################################################################### +# Netscape Plugin settings (ump.so - Unix Midi Plugin) + +# linker for making shared library + +UMP = ump.$(so) + +UMPOBJS = \ + npunix.o \ + UnixShell.o \ + plugin_c.o \ + timiditymain.o + +UMPLINKS = $(LIBS) -lXpm + +all: ump + +ump: $(UMPOBJS) + for f in libarc utils interface; do (cd $(top_builddir)/$$f; $(MAKE)); done + cd $(top_builddir)/timidity; $(MAKE) objs + $(SHLD) -o $(UMP) $(LDFLAGS) $(UMPOBJS) \ + `echo $(top_builddir)/timidity/*.o | sed -e s@$(top_builddir)/timidity/timidity.o@@g` \ + $(top_builddir)/libarc/*.o \ + $(top_builddir)/utils/*.o \ + $(top_builddir)/interface/*.o \ + $(UMPLINKS) + +clean: + rm -f $(UMP) + rm -f *.o + +timiditymain.o: $(top_srcdir)/timidity/timidity.c + $(COMPILE) -Dmain=timiditymain -o $@ -c $(top_srcdir)/timidity/timidity.c diff -ruN ump.orig/Makefile.in ump/Makefile.in --- ump.orig/Makefile.in Thu Jan 1 09:00:00 1970 +++ ump/Makefile.in Sun Apr 18 16:06:48 1999 @@ -0,0 +1,433 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# TiMidity++ -- MIDI to WAVE converter and player +# Copyright (C) 1999 Masanao Izumo +# Copyright (C) 1995 Tuukka Toivonen +# +# 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. +# +# This Makefile is known to work with GNU make. + + +# TiMidity++ -- MIDI to WAVE converter and player +# Copyright (C) 1999 Masanao Izumo +# Copyright (C) 1995 Tuukka Toivonen +# +# 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. + +# Define follows if you want to change. + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +CC = @CC@ +ELFILES = @ELFILES@ +EMACS = @EMACS@ +ESD_CFLAGS = @ESD_CFLAGS@ +ESD_CONFIG = @ESD_CONFIG@ +ESD_LIBS = @ESD_LIBS@ +EXEEXT = @EXEEXT@ +EXTRALIBS = @EXTRALIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +INTERFACE_SRCS = @INTERFACE_SRCS@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +NETSRCS = @NETSRCS@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +SHCFLAGS = @SHCFLAGS@ +SHLD = @SHLD@ +SYSEXTRAS = @SYSEXTRAS@ +VERSION = @VERSION@ +WISH = @WISH@ +dynamic_targets = @dynamic_targets@ +lispdir = @lispdir@ +program_transform_name = @program_transform_name@ +so = @so@ +tcltk_dep = @tcltk_dep@ + +SHELL = /bin/sh + +#CC= gcc +#CFLAGS = -O3 -Wall -mv8 -funroll-all-loops -fomit-frame-pointer -msupersparc -DAUDIO_FILLING_MILSEC=5000 +#CPPFLAGS = -I/usr1/home/mo/opt/include -I/usr/local/include -I/usr/local/X11/include -I/usr1/home/mo/opt/lib/glib/include -DENABLE_SHERRY -DSOLARIS -DAU_NAS -DAU_SUN -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\" -DXAW3D -DSUPPORT_SOCKET -DSUPPORT_SOUNDSPEC -DWRDT_X -DDEFAULT_PATH=\"$(TIMID_DIR)\" + +#DEFS = -DHAVE_CONFIG_H +#LDFLAGS = -L/usr1/home/mo/opt/lib -L/usr/local/lib -L/usr/local/X11/lib +#LIBS = -ltk4.2jp -ltcl7.6jp -lXm -lXaw3d -lXmu -lXt -lSM -lICE -lXext -lX11 -lnsl -lsocket -lm -lncurses -lslang -L/usr1/home/mo/opt/lib -L/usr/local/X11/lib -R/usr/local/X11/lib -lgtk -lgdk -lgmodule -lglib -ldl -lintl -lXext -lX11 -lsocket -lnsl -lw -lm -ldl -lpng -lz /usr/local/X11/lib/libaudio.a +#SHLD = /usr/ccs/bin/ld -G -L/usr1/home/mo/opt/lib -L/usr/local/lib -L/usr/local/X11/lib +#SHCFLAGS = -fPIC +# + +#prefix = /usr/local +#exec_prefix = ${prefix} +#bindir = ${exec_prefix}/bin +#libdir = ${exec_prefix}/lib +#mandir = ${prefix}/man +pkglibdir = $(libdir)/timidity +#INSTALL = ./install-sh -c + +# Where to install the patches, config files, and MIDI files. +# If you change this, it's a good idea to recompile the binary, +# or you'll need to invoke timidity with the -L option. +TIMID_DIR = $(pkglibdir) + +# Where to install the Tcl code, if you use the Tcl code that is. +TCL_DIR = $(pkglibdir) + +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libarc -I$(top_srcdir)/interface -I$(top_srcdir)/utils -I$(top_srcdir)/timidity $(EXTRAINCS) + + +noinst_LIBRARIES = libump.a + +libump_a_SOURCES = npunix.c UnixShell.c plugin_c.c + + +EXTRA_DIST = npunix.c UnixShell.c plugin_c.c jri.h jri_md.h jritypes.h npapi.h npupp.h minusdn.xpm minusup.xpm pausedn.xpm pauseup.xpm playdn.xpm playup.xpm plusdn.xpm plusup.xpm stopdn.xpm stopup.xpm ump.xpm + + +######################################################################### +# Netscape Plugin settings (ump.so - Unix Midi Plugin) + +# linker for making shared library + +UMP = ump.$(so) + +UMPOBJS = npunix.o UnixShell.o plugin_c.o timiditymain.o + + +UMPLINKS = $(LIBS) -lXpm +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h ../interface.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_LIBS = @X_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +libump_a_LIBADD = +libump_a_OBJECTS = npunix.o UnixShell.o plugin_c.o +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/UnixShell.P .deps/npunix.P .deps/plugin_c.P +SOURCES = $(libump_a_SOURCES) +OBJECTS = $(libump_a_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/common.makefile + cd $(top_srcdir) && $(AUTOMAKE) --gnu ump/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +libump.a: $(libump_a_OBJECTS) $(libump_a_DEPENDENCIES) + -rm -f libump.a + $(AR) cru libump.a $(libump_a_OBJECTS) $(libump_a_LIBADD) + $(RANLIB) libump.a + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = ump + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ump/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstLIBRARIES distclean-compile \ + distclean-tags distclean-depend distclean-generic \ + clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +all: ump + +ump: $(UMPOBJS) + for f in libarc utils interface; do (cd $(top_builddir)/$$f; $(MAKE)); done + cd $(top_builddir)/timidity; $(MAKE) objs + $(SHLD) -o $(UMP) $(LDFLAGS) $(UMPOBJS) \ + `echo $(top_builddir)/timidity/*.o | sed -e s@$(top_builddir)/timidity/timidity.o@@g` \ + $(top_builddir)/libarc/*.o \ + $(top_builddir)/utils/*.o \ + $(top_builddir)/interface/*.o \ + $(UMPLINKS) + +clean: + rm -f $(UMP) + rm -f *.o + +timiditymain.o: $(top_srcdir)/timidity/timidity.c + $(COMPILE) -Dmain=timiditymain -o $@ -c $(top_srcdir)/timidity/timidity.c + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -ruN ump.orig/UnixShell.c ump/UnixShell.c --- ump.orig/UnixShell.c Sat Apr 17 23:54:47 1999 +++ ump/UnixShell.c Sat Apr 17 23:55:34 1999 @@ -17,6 +17,9 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ #include /* sprintf(), fprintf(), etc. */ #include /* pid_t */ #include /* fork(), system(), unlink(), etc. */ @@ -38,7 +41,7 @@ #include /* Motif Picture Widget */ #include /* Motif Button Widget */ -#include "xpm.h" /* xpm library functions */ +#include /* xpm library functions */ #include "ump.xpm" /* UMP in XPM format */ /* buttons in XPM format */ @@ -56,10 +59,19 @@ #endif /* XP_UNIX */ /* default library, compatible with TIMIDITY */ -static const char *timdir = "/usr/local/lib/timidity"; +#ifndef DEFAULT_PATH +#define DEFAULT_PATH "/usr/local/lib/timidity" +#endif /* DEFAULT_PATH */ +static const char *timdir = DEFAULT_PATH; /* resort to slow sampling rate for busy/slow processors */ static int eightKFlag = 0; +static char *timid_ump_interface = "pqq"; +static int timid_ump_rate = 0; + +#ifndef HAVE_SNPRINTF +void snprintf(char *buff, size_t bufsiz, const char *fmt, ...); +#endif /*********************************************************************** * * @@ -90,8 +102,8 @@ static pid_t startMidiPlayer(const char *filename, int *pipes, int loop, int start){ - void timiditySetPipe(int p); - + extern void timiditySetPipe(int p); + extern int timiditymain(int argc, char **argv); pid_t pid; @@ -121,41 +133,63 @@ /* Now play the sound file */ { - static const char *argv[4]; - argv[0] = "timidity"; - argv[1] = "-Od"; - argv[2] = eightKFlag ? "-s8000": "-s22050"; /* check if the user specified 8K rate */ - argv[3] = filename; - + char *argv[16]; + char opt_interface[8]; + char opt_rate[32]; + int argc = 0; + + argv[argc++] = "timidity"; + argv[argc++] = "-Od"; + + if(timid_ump_rate <= 0) + argv[argc++] = eightKFlag ? "-s8000": "-s22050"; /* check if the user specified 8K rate */ + else + { + sprintf(opt_rate, "-s%d", timid_ump_rate); + argv[argc++] = opt_rate; + } + + opt_interface[0] = '-'; + opt_interface[1] = 'i'; + strncpy(opt_interface + 2, timid_ump_interface, sizeof(opt_interface) - 3); + opt_interface[sizeof(opt_interface) - 1] = '\0'; + argv[argc++] = opt_interface; + + argv[argc++] = (char *)filename; + argv[argc] = NULL; + /* change to the configuration directory */ chdir(timdir); - + + if(timid_ump_interface[0] != 'p') { + timiditymain(argc, argv); + _exit(0); + } + /* tell timidity where to read GUI input */ timiditySetPipe(pipes[0]); - + /* loop forever, until unloaded, wait for play to be enabled */ do { - + signed char c; - + /* wait for a new play command before starting */ if(!start) while (read(pipes[0], &c, 1) == 1 && c != ' '); - + start = ~0; /* we've started now! */ - + /* jump to timidity */ - timiditymain(4, argv); - + timiditymain(argc, argv); + if(!loop){ - /* wait for a new stop command before starting again */ - while (read(pipes[0], &c, 1) == 1 && c != ' '); - - /* wait for a new play command before starting again */ - while (read(pipes[0], &c, 1) == 1 && c != ' '); + /* wait for a new stop command before starting again */ + while (read(pipes[0], &c, 1) == 1 && c != ' '); + + /* wait for a new play command before starting again */ + while (read(pipes[0], &c, 1) == 1 && c != ' '); } - } while(~0); /* loop forever */ - } /* bye now */ @@ -196,6 +230,7 @@ } PluginInstance; +extern int setupLiveConnect(NPP instance, PluginInstance *This); /*********************************************************************** * @@ -210,12 +245,16 @@ char* NPP_GetMIMEDescription(void) { - - static char *desc = - "audio/midi:mid,midi:Larry Hoff's " - "UMP plugin version 1.10;" - "audio/x-midi:mid,midi:Larry Hoff's " - "UMP plugin version 1.10;"; + static char *desc = + "audio/midi:mid,midi,kar:MIDI Audio;" + "audio/x-midi:mid,midi,kar:MIDI Audio;" +#if 0 + "audio/x-gzipped-midi:gz:MIDI Audio;" +#endif + "audio/x-lha-midi:lzh:MIDI Audio;" + "audio/x-zipped-midi:zip:MIDI Audio;" + "audio/x-zipped-mod:zip:MOD Audio;" + "audio/x-mod:zip:MOD Audio;"; return(desc); } @@ -231,7 +270,7 @@ "This plugins plays MIDI, using the timidity " "toolkit, via the standard audio device.

" "By default, timidity configuration files are in the directory " - "/usr/local/lib/timidity

" + DEFAULT_PATH "

" "Use the TIMID_DIR environment variable to change " "the configuration directory.

" "You may set the environment variable TIMID_8K to " @@ -261,7 +300,9 @@ /* see if the user has specified an alternate directory for timidity */ if(getenv("TIMID_8K") != NULL) eightKFlag = 1; - + if(getenv("TIMID_INTERFACE") != NULL) timid_ump_interface = getenv("TIMID_INTERFACE"); + if(getenv("TIMID_RATE") != NULL) timid_ump_rate = atoi(getenv("TIMID_RATE")); + return NPERR_NO_ERROR; } @@ -276,10 +317,18 @@ NPSavedData* saved) { PluginInstance* This; - + char* ext = "mid"; + if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; + if (strncmp(pluginType, "audio/x-zipped", 13) == 0) ext = "zip"; +#if 0 + else if (strncmp(pluginType, "audio/x-gzipped", 15) == 0) ext = "gz"; +#endif + else if (strncmp(pluginType, "audio/x-lha", 11) == 0) ext = "lzh"; + else if (strncmp(pluginType, "audio/x-mod", 11) == 0) ext = "mod"; + instance->pdata = NPN_MemAlloc(sizeof(PluginInstance)); This = (PluginInstance*) instance->pdata; @@ -291,7 +340,7 @@ /* construct a filename unique to this instance to store the data in */ static char buf[256]; - sprintf(buf, "%s%x.mid", filestub, This); + snprintf(buf, sizeof(buf), "%s%x.mid", filestub, This); This->filename = buf; This->pid = -1; This->pipes[1] = -1; @@ -595,9 +644,13 @@ This->display = winInfo->display; /* tell XPM to allocate fairly close (not exact) colors from the window's colormap */ +#ifdef XpmAllocCloseColors attr.valuemask = XpmSize|XpmCloseness|XpmAllocCloseColors|XpmExactColors|XpmColormap|XpmDepth|XpmVisual; - attr.closeness = 30000; attr.alloc_close_colors = True; +#else + attr.valuemask = XpmSize|XpmCloseness|XpmExactColors|XpmColormap|XpmDepth|XpmVisual; +#endif + attr.closeness = 30000; attr.exactColors = False; attr.colormap = winInfo->colormap; attr.depth = winInfo->depth; @@ -783,7 +836,6 @@ NPBool seekable, uint16 *stype) { - NPByteRange range; PluginInstance* This; if (instance == NULL) @@ -866,14 +918,14 @@ NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) { PluginInstance* This; - if (instance != NULL) + if (instance != NULL) { This = (PluginInstance*) instance->pdata; /* just spwan timidity */ This->pid = startMidiPlayer(fname, This->pipes, This->loop, This->pluginState == PLUGIN_PLAYING); NPN_Status(instance, "Playing MIDI file"); - + } } @@ -884,7 +936,7 @@ return; if (instance != NULL) { - PluginInstance* This = (PluginInstance*) instance->pdata; +/* PluginInstance* This = (PluginInstance*) instance->pdata; */ if (printInfo->mode == NP_FULL) { /* @@ -904,10 +956,10 @@ * etc. */ - void* platformPrint = +/* void* platformPrint = printInfo->print.fullPrint.platformPrint; NPBool printOne = - printInfo->print.fullPrint.printOne; + printInfo->print.fullPrint.printOne; */ /* Do the default*/ printInfo->print.fullPrint.pluginPrinted = FALSE; @@ -925,17 +977,17 @@ * device context. */ - NPWindow* printWindow = +/* NPWindow* printWindow = &(printInfo->print.embedPrint.window); void* platformPrint = - printInfo->print.embedPrint.platformPrint; + printInfo->print.embedPrint.platformPrint; */ } } } #ifndef INCLUDE_LIVE_CONNECT -setupLiveConnect(NPP instance, PluginInstance *This){} +int setupLiveConnect(NPP instance, PluginInstance *This){return NPERR_NO_ERROR;} jref NPP_GetJavaClass() diff -ruN ump.orig/plugin_c.c ump/plugin_c.c --- ump.orig/plugin_c.c Sat Apr 17 23:54:47 1999 +++ ump/plugin_c.c Sun Apr 18 00:04:17 1999 @@ -21,35 +21,45 @@ Interface with UMP plugin */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ #include +#ifndef NO_STRING_H +#include +#else +#include +#endif #include #include #include -#include "config.h" +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include "timidity.h" #include "common.h" #include "output.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" -static void ctl_refresh(void); static void ctl_total_time(int tt); -static void ctl_master_volume(int mv); static void ctl_file_name(char *name); -static void ctl_current_time(int ct); -static void ctl_note(int v); -static void ctl_program(int ch, int val); -static void ctl_volume(int channel, int val); -static void ctl_expression(int channel, int val); -static void ctl_panning(int channel, int val); -static void ctl_sustain(int channel, int val); -static void ctl_pitch_bend(int channel, int val); -static void ctl_reset(void); +static void ctl_current_time(int secs, int v); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); +static void ctl_event(CtlEvent *e); /**********************************/ /* export the interface functions */ @@ -59,13 +69,15 @@ ControlMode ctl= { - "plugin interface", 'p', - 1,0,0, - ctl_open,dumb_pass_playing_list, ctl_close, ctl_read, cmsg, - ctl_refresh, ctl_reset, ctl_file_name, ctl_total_time, ctl_current_time, - ctl_note, - ctl_master_volume, ctl_program, ctl_volume, - ctl_expression, ctl_panning, ctl_sustain, ctl_pitch_bend + "plugin interface", 'p', + 1,0,0, + 0, + ctl_open, + ctl_close, + dumb_pass_playing_list, + ctl_read, + cmsg, + ctl_event }; static FILE *infp=stdin, *outfp=stdout; /* infp isn't actually used yet */ @@ -100,10 +112,6 @@ { unsigned char c; - /* support for pause/resume */ - static unsigned char playing = ~0; - int retval = RC_NONE; - if(read(myPipe, &c, 1) != 1) _exit(0); /* if they hang up, we're outa here */ switch(c) @@ -135,15 +143,7 @@ *valp=play_mode->rate; return RC_BACK; case ' ': - playing = ~playing; - - if(playing == 0) { - /* drain the play queue */ - play_mode->purge_output(); - /* wait until we get a command to restart */ - while((retval = ctl_read_blocked(valp)) == RC_NONE); - } - return RC_TOGGLE_PAUSE; /* this isn't supported by timidity yet */ + return RC_TOGGLE_PAUSE; /* Now supported by this improved timidity */ } return RC_NONE; @@ -151,14 +151,22 @@ static int ctl_read(int32 *valp) { - struct stat buf; - - if(fstat(myPipe, &buf) <0) return RC_NONE; - - if(buf.st_size == 0) return RC_NONE; - - return ctl_read_blocked(valp); + fd_set fds; + int cnt; + struct timeval timeout; + + FD_ZERO(&fds); + FD_SET(myPipe, &fds); + timeout.tv_sec = timeout.tv_usec = 0; + if((cnt = select(myPipe + 1, &fds, NULL, NULL, &timeout)) < 0) + { + perror("select"); + return -1; + } + if(!cnt || !FD_ISSET(myPipe, &fds)) + return RC_NONE; + return ctl_read_blocked(valp); } static int cmsg(int type, int verbosity_level, char *fmt, ...) @@ -182,8 +190,6 @@ return 0; } -static void ctl_refresh(void) { } - static void ctl_total_time(int tt) { int mins, secs; @@ -196,20 +202,17 @@ } } -static void ctl_master_volume(int mv) {} - static void ctl_file_name(char *name) { if (ctl.verbosity>=0 || ctl.trace_playing) fprintf(outfp, "Playing %s\n", name); } -static void ctl_current_time(int ct) +static void ctl_current_time(int secs, int v) { - int mins, secs; + int mins; if (ctl.trace_playing) { - secs=ct/play_mode->rate; mins=secs/60; secs-=mins*60; fprintf(outfp, "\r%3d:%02d", mins, secs); @@ -217,18 +220,18 @@ } } -static void ctl_note(int v) {} - -static void ctl_program(int ch, int val) {} - -static void ctl_volume(int channel, int val) {} - -static void ctl_expression(int channel, int val) {} - -static void ctl_panning(int channel, int val) {} - -static void ctl_sustain(int channel, int val) {} - -static void ctl_pitch_bend(int channel, int val) {} - -static void ctl_reset(void) {} +static void ctl_event(CtlEvent *e) +{ + switch(e->type) + { + case CTLE_NOW_LOADING: + ctl_file_name((char *)e->v1); + break; + case CTLE_PLAY_START: + ctl_total_time((int)e->v1); + break; + case CTLE_CURRENT_TIME: + ctl_current_time((int)e->v1, (int)e->v2); + break; + } +}