From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/classpath/native/jni/midi-dssi/.cvsignore | 9 + libjava/classpath/native/jni/midi-dssi/Makefile.am | 15 + libjava/classpath/native/jni/midi-dssi/Makefile.in | 619 +++++++++++++++++++++ libjava/classpath/native/jni/midi-dssi/README | 134 +++++ libjava/classpath/native/jni/midi-dssi/dssi_data.h | 114 ++++ ..._javax_sound_midi_dssi_DSSIMidiDeviceProvider.c | 139 +++++ .../gnu_javax_sound_midi_dssi_DSSISynthesizer.c | 584 +++++++++++++++++++ 7 files changed, 1614 insertions(+) create mode 100644 libjava/classpath/native/jni/midi-dssi/.cvsignore create mode 100644 libjava/classpath/native/jni/midi-dssi/Makefile.am create mode 100644 libjava/classpath/native/jni/midi-dssi/Makefile.in create mode 100644 libjava/classpath/native/jni/midi-dssi/README create mode 100644 libjava/classpath/native/jni/midi-dssi/dssi_data.h create mode 100644 libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c create mode 100644 libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c (limited to 'libjava/classpath/native/jni/midi-dssi') diff --git a/libjava/classpath/native/jni/midi-dssi/.cvsignore b/libjava/classpath/native/jni/midi-dssi/.cvsignore new file mode 100644 index 000000000..ac18ca272 --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/.cvsignore @@ -0,0 +1,9 @@ +*.o +*.a +*.lo +*.la +.libs +.depsMakefile +Makefile.in +.deps +Makefile diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.am b/libjava/classpath/native/jni/midi-dssi/Makefile.am new file mode 100644 index 000000000..ee12bf2e9 --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/Makefile.am @@ -0,0 +1,15 @@ +nativeexeclib_LTLIBRARIES = libgjsmdssi.la + +libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \ + gnu_javax_sound_midi_dssi_DSSISynthesizer.c \ + dssi_data.h + +libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack +libgjsmdssi_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version + +AM_LDFLAGS = @CLASSPATH_MODULE@ +AM_CPPFLAGS = @CLASSPATH_INCLUDES@ +# No STRICT_WARNING_CFLAGS here as we use dlsym to load the address of +# a function,and ISO C prohibits casting void pointers, like those returned +# by dlsym, to function pointers. +AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ @EXTRA_CFLAGS@ diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.in b/libjava/classpath/native/jni/midi-dssi/Makefile.in new file mode 100644 index 000000000..7eed5df96 --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/Makefile.in @@ -0,0 +1,619 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = native/jni/midi-dssi +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \ + $(top_srcdir)/../../config/lead-dot.m4 \ + $(top_srcdir)/../../config/lib-ld.m4 \ + $(top_srcdir)/../../config/lib-link.m4 \ + $(top_srcdir)/../../config/lib-prefix.m4 \ + $(top_srcdir)/../../config/multi.m4 \ + $(top_srcdir)/../../config/no-executables.m4 \ + $(top_srcdir)/../../config/override.m4 \ + $(top_srcdir)/../../libtool.m4 \ + $(top_srcdir)/../../ltoptions.m4 \ + $(top_srcdir)/../../ltsugar.m4 \ + $(top_srcdir)/../../ltversion.m4 \ + $(top_srcdir)/../../lt~obsolete.m4 \ + $(top_srcdir)/m4/ac_prog_antlr.m4 \ + $(top_srcdir)/m4/ac_prog_java.m4 \ + $(top_srcdir)/m4/ac_prog_java_works.m4 \ + $(top_srcdir)/m4/ac_prog_javac.m4 \ + $(top_srcdir)/m4/ac_prog_javac_works.m4 \ + $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \ + $(top_srcdir)/m4/acinclude.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/ax_func_which_gethostbyname_r.m4 \ + $(top_srcdir)/m4/gcc_attribute.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(nativeexeclibdir)" +LTLIBRARIES = $(nativeexeclib_LTLIBRARIES) +libgjsmdssi_la_DEPENDENCIES = \ + $(top_builddir)/native/jni/classpath/jcl.lo +am_libgjsmdssi_la_OBJECTS = \ + gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.lo \ + gnu_javax_sound_midi_dssi_DSSISynthesizer.lo +libgjsmdssi_la_OBJECTS = $(am_libgjsmdssi_la_OBJECTS) +libgjsmdssi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libgjsmdssi_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/../../depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libgjsmdssi_la_SOURCES) +ETAGS = etags +CTAGS = ctags +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +ANTLR = @ANTLR@ +ANTLR_JAR = @ANTLR_JAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@ +CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@ +CLASSPATH_MODULE = @CLASSPATH_MODULE@ +COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@ +CP = @CP@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATE = @DATE@ +DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECJ_JAR = @ECJ_JAR@ +EGREP = @EGREP@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXAMPLESDIR = @EXAMPLESDIR@ +EXEEXT = @EXEEXT@ +EXTRA_CFLAGS = @EXTRA_CFLAGS@ +FGREP = @FGREP@ +FIND = @FIND@ +FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@ +FREETYPE2_LIBS = @FREETYPE2_LIBS@ +GCONF_CFLAGS = @GCONF_CFLAGS@ +GCONF_LIBS = @GCONF_LIBS@ +GDK_CFLAGS = @GDK_CFLAGS@ +GDK_LIBS = @GDK_LIBS@ +GJDOC = @GJDOC@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMP_CFLAGS = @GMP_CFLAGS@ +GMP_LIBS = @GMP_LIBS@ +GREP = @GREP@ +GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@ +GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ +GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@ +GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@ +GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JAR = @JAR@ +JAVA = @JAVA@ +JAVAC = @JAVAC@ +JAVAC_IS_GCJ = @JAVAC_IS_GCJ@ +JAVAC_MEM_OPT = @JAVAC_MEM_OPT@ +JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@ +JAY = @JAY@ +JAY_SKELETON = @JAY_SKELETON@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDEBUG = @LIBDEBUG@ +LIBICONV = @LIBICONV@ +LIBMAGIC = @LIBMAGIC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBVERSION = @LIBVERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR = @MKDIR@ +MKDIR_P = @MKDIR_P@ +MOC = @MOC@ +MOZILLA_CFLAGS = @MOZILLA_CFLAGS@ +MOZILLA_LIBS = @MOZILLA_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@ +PANGOFT2_LIBS = @PANGOFT2_LIBS@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PATH_TO_ESCHER = @PATH_TO_ESCHER@ +PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGIN_DIR = @PLUGIN_DIR@ +QT_CFLAGS = @QT_CFLAGS@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +REMOVE = @REMOVE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@ +STRIP = @STRIP@ +TOOLSDIR = @TOOLSDIR@ +USER_JAVAH = @USER_JAVAH@ +VERSION = @VERSION@ +WANT_NATIVE_BIG_INTEGER = @WANT_NATIVE_BIG_INTEGER@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +XMKMF = @XMKMF@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +XSLT_CFLAGS = @XSLT_CFLAGS@ +XSLT_LIBS = @XSLT_LIBS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ZIP = @ZIP@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_ANTLR = @ac_ct_ANTLR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +default_toolkit = @default_toolkit@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +glibjdir = @glibjdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +multi_basedir = @multi_basedir@ +nativeexeclibdir = @nativeexeclibdir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +toolexeclibdir = @toolexeclibdir@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +uudecode = @uudecode@ +vm_classes = @vm_classes@ +nativeexeclib_LTLIBRARIES = libgjsmdssi.la +libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \ + gnu_javax_sound_midi_dssi_DSSISynthesizer.c \ + dssi_data.h + +libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack +libgjsmdssi_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version +AM_LDFLAGS = @CLASSPATH_MODULE@ +AM_CPPFLAGS = @CLASSPATH_INCLUDES@ +# No STRICT_WARNING_CFLAGS here as we use dlsym to load the address of +# a function,and ISO C prohibits casting void pointers, like those returned +# by dlsym, to function pointers. +AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ @EXTRA_CFLAGS@ +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/midi-dssi/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu native/jni/midi-dssi/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(nativeexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(nativeexeclibdir)" + @list='$(nativeexeclib_LTLIBRARIES)'; test -n "$(nativeexeclibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(nativeexeclibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(nativeexeclibdir)"; \ + } + +uninstall-nativeexeclibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(nativeexeclib_LTLIBRARIES)'; test -n "$(nativeexeclibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$f"; \ + done + +clean-nativeexeclibLTLIBRARIES: + -test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES) + @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgjsmdssi.la: $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_DEPENDENCIES) + $(libgjsmdssi_la_LINK) -rpath $(nativeexeclibdir) $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSISynthesizer.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-nativeexeclibLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-nativeexeclibLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-nativeexeclibLTLIBRARIES install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-nativeexeclibLTLIBRARIES + + +# 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 --git a/libjava/classpath/native/jni/midi-dssi/README b/libjava/classpath/native/jni/midi-dssi/README new file mode 100644 index 000000000..6913414ff --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/README @@ -0,0 +1,134 @@ +The file native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c +contains two functions (get_port_default and set_control) derived from +example code in the DSSI distribution (http://dssi.sourceforge.net). +The original DSSI example code is distributed under the following +terms: + + Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton. + + Permission to use, copy, modify, distribute, and sell this software + for any purpose is hereby granted without fee, provided that the + above copyright notice and this permission notice are included in + all copies or substantial portions of the software. + + +The rest of this file contain the original versions of these +functions. + + +LADSPA_Data get_port_default(const LADSPA_Descriptor *plugin, int port) +{ + LADSPA_PortRangeHint hint = plugin->PortRangeHints[port]; + float lower = hint.LowerBound * + (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f); + float upper = hint.UpperBound * + (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f); + + if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor)) { + if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) || + !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) { + /* No hint, its not bounded, wild guess */ + return 0.0f; + } + + if (lower <= 0.0f && upper >= 0.0f) { + /* It spans 0.0, 0.0 is often a good guess */ + return 0.0f; + } + + /* No clues, return minimum */ + return lower; + } + + /* Try all the easy ones */ + + if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor)) { + return 0.0f; + } else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor)) { + return 1.0f; + } else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor)) { + return 100.0f; + } else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor)) { + return 440.0f; + } + + /* All the others require some bounds */ + + if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) { + if (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)) { + return lower; + } + } + if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) { + if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor)) { + return upper; + } + if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) { + if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor)) { + return lower * 0.75f + upper * 0.25f; + } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor)) { + return lower * 0.5f + upper * 0.5f; + } else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor)) { + return lower * 0.25f + upper * 0.75f; + } + } + } + + /* fallback */ + return 0.0f; +} + + +void +setControl(d3h_instance_t *instance, long controlIn, snd_seq_event_t *event) +{ + long port = pluginControlInPortNumbers[controlIn]; + + const LADSPA_Descriptor *p = instance->plugin->descriptor->LADSPA_Plugin; + + LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor; + + LADSPA_Data lb = p->PortRangeHints[port].LowerBound * + (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ? + sample_rate : 1.0f); + + LADSPA_Data ub = p->PortRangeHints[port].UpperBound * + (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ? + sample_rate : 1.0f); + + float value = (float)event->data.control.value; + + if (!LADSPA_IS_HINT_BOUNDED_BELOW(d)) { + if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { + /* unbounded: might as well leave the value alone. */ + } else { + /* bounded above only. just shift the range. */ + value = ub - 127.0f + value; + } + } else { + if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { + /* bounded below only. just shift the range. */ + value = lb + value; + } else { + /* bounded both ends. more interesting. */ + if (LADSPA_IS_HINT_LOGARITHMIC(d)) { + const float llb = logf(lb); + const float lub = logf(ub); + + value = expf(llb + ((lub - llb) * value / 127.0f)); + } else { + value = lb + ((ub - lb) * value / 127.0f); + } + } + } + + if (verbose) { + printf("%s: %s MIDI controller %d=%d -> control in %ld=%f\n", myName, + instance->friendly_name, event->data.control.param, + event->data.control.value, controlIn, value); + } + + pluginControlIns[controlIn] = value; + pluginPortUpdated[controlIn] = 1; +} + diff --git a/libjava/classpath/native/jni/midi-dssi/dssi_data.h b/libjava/classpath/native/jni/midi-dssi/dssi_data.h new file mode 100644 index 000000000..f8243f29b --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/dssi_data.h @@ -0,0 +1,114 @@ +/* dssi_data.h - DSSI data + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "../classpath/jcl.h" + +/* Specify the size of the circular buffer. It only needs to be big + enough to hold the events that happen between jack callbacks (~ + 1/40th of a second). */ +#define EVENT_BUFFER_SIZE 1024 + +/* Every DSSI Synthesizer has one of these associated with it. The + Java class sees it as a "long" handle. */ + +typedef struct +{ + /* This is a handle to the dlopen'ed .so file containing the DSSI + synthesizer. */ + void *dlhandle; + + /* The function to call to get the DSS_Descriptor. */ + DSSI_Descriptor_Function fn; + + /* The descriptor for this synthesizer. See the dssi.h system + header. */ + const DSSI_Descriptor *desc; + + /* We currently open a jack client connection for every + synthesizer. */ + jack_client_t *jack_client; + + /* We currently only handle stereo jack connections. Output from + mono synthesizers is sent to both left and right ports. */ + jack_port_t *jack_left_output_port; + jack_port_t *jack_right_output_port; + + /* We use a circular buffer to hold MIDI events before processing + them in the jack audio processing callback function. */ + snd_seq_event_t midiEventBuffer[EVENT_BUFFER_SIZE]; + int midiEventReadIndex; + int midiEventWriteIndex; + + /* This is a handle the synthesizers underlying LADSPA structure. + See the ladspa.h system header for details. */ + LADSPA_Handle plugin_handle; + + /* These are buffers we pass to the DSSI Synthesizer for + filling. */ + float *left_buffer; + float *right_buffer; + + /* The number of input controls for this synth. */ + unsigned control_count; + + /* An array of control values, control_count in length. */ + LADSPA_Data *control_values; + + /* A mapping of MIDI controllers to control values. There are a + maximum of 128 MIDI controllers. */ + unsigned control_value_map[128]; + + /* A mapping of MIDI controllers to LADSPA ports. There are a + maximum of 128 MIDI controllers. */ + unsigned control_port_map[128]; + + /* The sample rate. */ + jack_nframes_t sample_rate; + +} dssi_data; + diff --git a/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c new file mode 100644 index 000000000..3cad45931 --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c @@ -0,0 +1,139 @@ +/* gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c - DSSI Provider + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +#include +#include + +#include "dssi_data.h" + +void +Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlclose_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), jlong sohandle) +{ + dssi_data *data = (dssi_data *) (long) sohandle; + dlclose (data->dlhandle); + JCL_free (env, data); +} + +jlong +Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlopen_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), jstring name) +{ + const char *filename; + void *handle; + DSSI_Descriptor_Function fn; + dssi_data *data = 0; + + filename = JCL_jstring_to_cstring (env, name); + if (filename == NULL) + return (0); + + handle = dlopen(filename, RTLD_NOW); + + if (handle == 0) + goto done; + + fn = (DSSI_Descriptor_Function) dlsym(handle, "dssi_descriptor"); + + if (fn == 0) + { + dlclose(handle); + goto done; + } + + data = (dssi_data *) JCL_malloc(env, sizeof(dssi_data)); + data->dlhandle = handle; + data->fn = fn; + data->midiEventReadIndex = 0; + data->midiEventWriteIndex = 0; + + done: + JCL_free_cstring (env, name, filename); + return PTR_TO_JLONG(data); +} + +jlong +Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIHandle_1 + (JNIEnv *env __attribute__((unused)), + jclass clazz __attribute__((unused)), jlong handle, jlong index) +{ + dssi_data *data = JLONG_TO_PTR(dssi_data,handle); + data->desc = (data->fn)(index); + return PTR_TO_JLONG(data->desc); +} + +jstring +Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIName_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle) +{ + DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle); + const char *str = desc->LADSPA_Plugin->Name; + + return (*env)->NewStringUTF (env, str); +} + +jstring +Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSICopyright_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle) +{ + DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle); + const char *str = desc->LADSPA_Plugin->Copyright; + + return (*env)->NewStringUTF (env, str); +} + +jstring +Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIVendor_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle) +{ + DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle); + const char *str = desc->LADSPA_Plugin->Maker; + + return (*env)->NewStringUTF (env, str); +} + +jstring +Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSILabel_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle) +{ + DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle); + const char *str = desc->LADSPA_Plugin->Label; + + return (*env)->NewStringUTF (env, str); +} + + diff --git a/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c new file mode 100644 index 000000000..ec1477ec8 --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c @@ -0,0 +1,584 @@ +/* gnu_javax_sound_midi_dssi_DSSISynthesizer.c - DSSI Synth + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +/* The original get_port_default() and set_control() routines were + * copied from the DSSI source distribution and are covered by the + * following copyright and license... + * + * Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton. + * + * Permission to use, copy, modify, distribute, and sell this software + * for any purpose is hereby granted without fee, provided that the + * above copyright notice and this permission notice are included in + * all copies or substantial portions of the software. + */ + +#include +#include +#include + +#include "dssi_data.h" + +/* Define this for debug output. */ +#undef DEBUG_DSSI_PROVIDER + +static void set_control (dssi_data *data, snd_seq_event_t *event); + + +/** + * The jack callback routine. + * + * This function is called by the jack audio system in its own thread + * whenever it needs new audio data. + * + */ +static int +process (jack_nframes_t nframes, void *arg) +{ + dssi_data *data = (dssi_data *) arg; + int index; + jack_default_audio_sample_t *buffer; + + /* Look through the event buffer to see if any control values + need changing. */ + for ( index = data->midiEventReadIndex; + index != data->midiEventWriteIndex; + index = (index + 1) % EVENT_BUFFER_SIZE) + { + if (data->midiEventBuffer[index].type == SND_SEQ_EVENT_CONTROLLER) + set_control (data, & data->midiEventBuffer[index]); + } + + if (data->desc->run_synth) + { + /* Call the synth audio processing routine. */ + data->desc->run_synth + (data->plugin_handle, + nframes, + &data->midiEventBuffer[data->midiEventReadIndex], + data->midiEventWriteIndex - data->midiEventReadIndex); + } + else + if (data->desc->run_multiple_synths) + { + snd_seq_event_t *events = + &data->midiEventBuffer[data->midiEventReadIndex]; + unsigned long event_count = + data->midiEventWriteIndex - data->midiEventReadIndex; + + /* Call the synth audio processing routine. */ + data->desc->run_multiple_synths + (1, + & (data->plugin_handle), + nframes, + &events, + &event_count); + } + + /* Update the read index on our circular buffer. */ + data->midiEventReadIndex = data->midiEventWriteIndex; + + /* Copy output from the synth to jack. + + FIXME: This is hack that only gets one channel from the synth and + send that to both jack ports (until we handle stero synths + properly). + + FIXME: Can we avoid this copying? */ + buffer = jack_port_get_buffer(data->jack_left_output_port, nframes); + memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data)); + buffer = jack_port_get_buffer(data->jack_right_output_port, nframes); + memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data)); + + return 0; +} + + +/** + * Calculate a reasonable default value for a specific control port. + * This is mostly copied from the DSSI example code. Copyright info + * is found at the top of this file. + * + */ +static LADSPA_Data +get_port_default (const LADSPA_Descriptor *plugin, + int port, jack_nframes_t sample_rate) +{ + LADSPA_PortRangeHint hint = plugin->PortRangeHints[port]; + float lower = hint.LowerBound * + (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f); + float upper = hint.UpperBound * + (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f); + + if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor)) + { + if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) || + !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) + { + /* No hint, its not bounded, wild guess */ + return 0.0f; + } + + if (lower <= 0.0f && upper >= 0.0f) + { + /* It spans 0.0, 0.0 is often a good guess */ + return 0.0f; + } + + /* No clues, return minimum */ + return lower; + } + + /* Try all the easy ones */ + + if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor)) + return 0.0f; + else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor)) + return 1.0f; + else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor)) + return 100.0f; + else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor)) + return 440.0f; + + /* All the others require some bounds */ + + if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) + && (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor))) + return lower; + + if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) + { + if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor)) + return upper; + + if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) + { + if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor)) + return lower * 0.75f + upper * 0.25f; + else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor)) + return lower * 0.5f + upper * 0.5f; + else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor)) + return lower * 0.25f + upper * 0.75f; + } + } + + /* fallback */ + return 0.0f; +} + +/** + * Set a control value by mapping the MIDI event to a suitable value + * for this control. + * This is mostly copied from the DSSI example code. Copyright info + * is found at the top of this file. + * + */ +static void +set_control(dssi_data *data, snd_seq_event_t *event) +{ + unsigned control = event->data.control.param; + unsigned port = data->control_port_map[control]; + + const LADSPA_Descriptor *p = data->desc->LADSPA_Plugin; + + LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor; + + LADSPA_Data lb = p->PortRangeHints[port].LowerBound * + (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ? + data->sample_rate : 1.0f); + + LADSPA_Data ub = p->PortRangeHints[port].UpperBound * + (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ? + data->sample_rate : 1.0f); + + float value = (float)event->data.control.value; + + if (!LADSPA_IS_HINT_BOUNDED_BELOW(d)) + { + if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) + { + /* unbounded: might as well leave the value alone. */ + } + else + { + /* bounded above only. just shift the range. */ + value = ub - 127.0f + value; + } + } + else + { + if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) + { + /* bounded below only. just shift the range. */ + value = lb + value; + } + else + { + /* bounded both ends. more interesting. */ + if (LADSPA_IS_HINT_LOGARITHMIC(d)) + { + const float llb = logf(lb); + const float lub = logf(ub); + + value = expf(llb + ((lub - llb) * value / 127.0f)); + } + else + { + value = lb + ((ub - lb) * value / 127.0f); + } + } + } + +#ifdef DEBUG_DSSI_PROVIDER + printf("MIDI controller %d=%d -> control in %u=%f\n", + event->data.control.param, + event->data.control.value, + data->control_value_map[control], value); +#endif + + data->control_values[data->control_value_map[control]] = value; +} + +/** + * Open a new synthesizer. This currently involves instantiating a + * new synth, creating a new jack client connection, and activating + * both. + * + */ +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle) +{ + unsigned int port_count, j, cindex; + const char **ports; + int controller = 0; + dssi_data *data = (dssi_data *) (long) handle; + if ((data->jack_client = jack_client_new (data->desc->LADSPA_Plugin->Label)) == 0) + { + /* JCL_ThrowException (env, "javax/sound/midi/MidiUnavailableException", */ + JCL_ThrowException (env, "java/io/IOException", + "can't create jack client"); + return; + } + + /* Get the jack sample rate, which may be used in default control port + value calculations. */ + data->sample_rate = jack_get_sample_rate (data->jack_client); + + data->plugin_handle = + (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, + data->sample_rate); + + if (jack_set_process_callback (data->jack_client, process, data) != 0) + { + JCL_ThrowException (env, "java/io/IOException", + "can't set jack process callback"); + return; + } + + data->jack_left_output_port = + jack_port_register (data->jack_client, "output_left", + JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); + data->jack_right_output_port = + jack_port_register (data->jack_client, "output_right", + JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); + + /* Count the number of controls and audio ouput ports. */ + port_count = data->control_count = 0; + for (j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++) + { + LADSPA_PortDescriptor pod = + data->desc->LADSPA_Plugin->PortDescriptors[j]; + + if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod)) + port_count++; + else if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod)) + data->control_count++; + } + + /* Allocate the array of control values. */ + data->control_values = + (LADSPA_Data *) JCL_malloc (env, + data->control_count * sizeof (LADSPA_Data)); + + /* Initialize the MIDI control map. */ + memset (data->control_value_map, 0, data->control_count * sizeof(unsigned)); + + /* Create buffers for each port. */ + for (cindex = 0, j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++) + { + LADSPA_PortDescriptor pod = + data->desc->LADSPA_Plugin->PortDescriptors[j]; + if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod)) + { + data->left_buffer = + (float *) calloc(jack_get_buffer_size(data->jack_client), + sizeof(float)); + (data->desc->LADSPA_Plugin->connect_port)(data->plugin_handle, j, + data->left_buffer); + } + else + if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod)) + { + /* This is an input control port. Connect it to a properly + initialized value in our controller value array. */ + (data->desc->LADSPA_Plugin->connect_port) + (data->plugin_handle, j, &(data->control_values[cindex])); + data->control_values[cindex] = + get_port_default (data->desc->LADSPA_Plugin, + j, data->sample_rate); + + /* Set up the mapping between MIDI controllers and this + contoller value. */ + if (data->desc->get_midi_controller_for_port) + { + controller = data->desc-> + get_midi_controller_for_port(data->plugin_handle, j); + + if ((controller != DSSI_NONE) && DSSI_IS_CC(controller)) + { + data->control_value_map[DSSI_CC_NUMBER(controller)] = cindex; + data->control_port_map[DSSI_CC_NUMBER(controller)] = j; + +#ifdef DEBUG_DSSI_PROVIDER + printf ("MIDI Controller 0x%x [%s] = %g\n", + DSSI_CC_NUMBER(controller), + data->desc->LADSPA_Plugin->PortNames[j], + data->control_values[cindex]); +#endif + } + } + + cindex++; + } + } + + (data->desc->LADSPA_Plugin->activate)(data->plugin_handle); + + if (jack_activate (data->jack_client)) + JCL_ThrowException (env, "java/io/IOException", + "can't activate jack client"); + + /* Try to connect the synth output to hardware audio ports. */ + ports = jack_get_ports (data->jack_client, NULL, NULL, + JackPortIsPhysical | JackPortIsInput); + if (ports) + { + if (ports[0] && ports[1]) + { + /* Don't bother checking return values. Failing is OK. */ + jack_connect (data->jack_client, + jack_port_name (data->jack_left_output_port), + ports[0]); + jack_connect (data->jack_client, + jack_port_name (data->jack_right_output_port), + ports[1]); + } + free(ports); + } +} + +/** + * This is called when we receive a new MIDI CONTROL CHANGE message. + * Simply stick an appropriate event in the event buffer. This will + * get processed in the jack callback function. + */ +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_controlChange_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint channel, jint control, jint value) +{ + dssi_data *data = JLONG_TO_PTR(dssi_data,handle); + + /* Insert this event in the event buffer. */ + snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex]; + + /* Set the event value. */ + snd_seq_ev_set_controller (ev, channel, control, value); + + data->midiEventWriteIndex = + (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE; +} + +/** + * This is called when we receive a new MIDI NOTE ON message. Simply + * stick an appropriate event in the event buffer. This will get + * processed in the jack callback function. + */ +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint channel, jint note, jint velocity) +{ + dssi_data *data = JLONG_TO_PTR(dssi_data,handle); + + /* Insert this event in the event buffer. */ + snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex]; + + ev->type = SND_SEQ_EVENT_NOTEON; + ev->data.control.channel = channel; + ev->data.note.note = note; + ev->data.note.velocity = velocity; + + data->midiEventWriteIndex = + (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE; +} + +/** + * This is called when we receive a new MIDI NOTE OFF message. Simply + * stick an appropriate event in the event buffer. This will get + * processed in the jack callback function. + */ +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1 + (JNIEnv *env __attribute__((unused)), + jclass clazz __attribute__((unused)), + jlong handle, jint channel, jint note, jint velocity) +{ + dssi_data *data = JLONG_TO_PTR(dssi_data,handle); + + /* Insert this event in the event buffer. */ + snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex]; + + ev->type = SND_SEQ_EVENT_NOTEOFF; + ev->data.control.channel = channel; + ev->data.note.note = note; + ev->data.note.velocity = velocity; + + data->midiEventWriteIndex = + (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE; +} + +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_setPolyPressure_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle __attribute__((unused)), jint channel __attribute__((unused)), + jint note __attribute__((unused)), jint velocity __attribute__((unused))) +{ +} + +JNIEXPORT jint JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getPolyPressure_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle __attribute__((unused)), jint channel __attribute__((unused)), + jint note __attribute__((unused))) +{ + return 0; +} + +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_close_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle __attribute__((unused))) +{ +} + +/* FIXME: These next three functions are really inefficient because + we're instantiating and cleaning up plugin instances just to query + values. */ + +JNIEXPORT jstring JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), + jlong handle, jint index) +{ + LADSPA_Handle lhandle; + jstring name = (jstring) NULL; + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + if (data->desc->get_program == NULL) + return NULL; + lhandle = + (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, + 48000); + const DSSI_Program_Descriptor *program = + (data->desc->get_program)(lhandle, (unsigned long) index); + if (program) + name = (*env)->NewStringUTF (env, program->Name); + (data->desc->LADSPA_Plugin->cleanup)(lhandle); + + return name; +} + +JNIEXPORT jint JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint index) +{ + LADSPA_Handle lhandle; + jint result = -1; + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + lhandle = + (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, + 48000); + const DSSI_Program_Descriptor *program = + (data->desc->get_program)(lhandle, (unsigned long) index); + if (program) + result = (jint) program->Bank; + (data->desc->LADSPA_Plugin->cleanup)(lhandle); + return result; +} + +JNIEXPORT jint JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint index) +{ + LADSPA_Handle lhandle; + jint result = -1; + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + lhandle = + (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, + 48000); + const DSSI_Program_Descriptor *program = + (data->desc->get_program)(lhandle, (unsigned long) index); + if (program) + result = (jint) program->Program; + (data->desc->LADSPA_Plugin->cleanup)(lhandle); + return result; +} + + +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint bank, jint program) +{ + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + + (data->desc->select_program)(data->plugin_handle, + (unsigned) bank, (unsigned) program); +} -- cgit v1.2.3